Skip to content

Commit

Permalink
Fixed tests
Browse files Browse the repository at this point in the history
Signed-off-by: Pavel Tisnovsky <[email protected]>
  • Loading branch information
tisnik committed Jan 22, 2025
1 parent 474c6b9 commit fa2761e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
4 changes: 3 additions & 1 deletion ols/app/endpoints/feedback.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,9 @@ def feedback_status() -> StatusResponse:
"""
logger.debug("feedback status request received")
feedback_status_enabled = is_feedback_enabled()
return StatusResponse(functionality="feedback", status={"enabled": feedback_status_enabled})
return StatusResponse(
functionality="feedback", status={"enabled": feedback_status_enabled}
)


post_feedback_responses: dict[int | str, dict[str, Any]] = {
Expand Down
14 changes: 7 additions & 7 deletions tests/e2e/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -304,25 +304,25 @@ def test_openapi_endpoint():
), "OpenAPI schema returned from service does not have expected content."


def test_cache_existence(postgres_connection):
def test_cache_existence(postgres_db_connection):
"""Test the cache existence."""
if postgres_connection is None:
if postgres_db_connection is None:
pytest.skip("Postgres is not accessible.")

value = read_conversation_history_count(postgres_connection)
value = read_conversation_history_count(postgres_db_connection)
# check if history exists at all
assert value is not None


def test_conversation_in_postgres_cache(postgres_connection) -> None:
def test_conversation_in_postgres_cache(postgres_db_connection) -> None:
"""Check how/if the conversation is stored in cache."""
if postgres_connection is None:
if postgres_db_connection is None:
pytest.skip("Postgres is not accessible.")

cid = suid.get_suid()
client_utils.perform_query(pytest.client, cid, "what is kubernetes?")

conversation, updated_at = read_conversation_history(postgres_connection, cid)
conversation, updated_at = read_conversation_history(postgres_db_connection, cid)
assert conversation is not None
assert updated_at is not None

Expand All @@ -342,7 +342,7 @@ def test_conversation_in_postgres_cache(postgres_connection) -> None:
# second question
client_utils.perform_query(pytest.client, cid, "what is openshift virtualization?")

conversation, updated_at = read_conversation_history(postgres_connection, cid)
conversation, updated_at = read_conversation_history(postgres_db_connection, cid)
assert conversation is not None

# unpickle conversation into list of messages
Expand Down

0 comments on commit fa2761e

Please sign in to comment.