Преглед на файлове

test(api): fix flaky tests in TestWorkflowDraftVariableService (#23749)

Fix flaky test
`TestWorkflowDraftVariableService.test_list_variables_without_values_success`
caused by low entropy in test data generation that led to
duplicate values violating unique constraints.

Also improve data generation in other tests within
`TestWorkflowDraftVariableService` to reduce the likelihood of
generating duplicate test data.
tags/1.8.0
QuantumGhost преди 2 месеца
родител
ревизия
223c1a8089
No account linked to committer's email address
променени са 1 файла, в които са добавени 3 реда и са изтрити 3 реда
  1. 3
    3
      api/tests/test_containers_integration_tests/services/test_workflow_draft_variable_service.py

+ 3
- 3
api/tests/test_containers_integration_tests/services/test_workflow_draft_variable_service.py Целия файл

@@ -263,7 +263,7 @@ class TestWorkflowDraftVariableService:
fake = Faker()
app = self._create_test_app(db_session_with_containers, mock_external_service_dependencies, fake=fake)
for i in range(5):
test_value = StringSegment(value=fake.numerify("value##"))
test_value = StringSegment(value=fake.numerify("value######"))
self._create_test_variable(
db_session_with_containers, app.id, CONVERSATION_VARIABLE_NODE_ID, fake.word(), test_value, fake=fake
)
@@ -480,7 +480,7 @@ class TestWorkflowDraftVariableService:
fake = Faker()
app = self._create_test_app(db_session_with_containers, mock_external_service_dependencies, fake=fake)
for i in range(3):
test_value = StringSegment(value=fake.numerify("value##"))
test_value = StringSegment(value=fake.numerify("value######"))
self._create_test_variable(
db_session_with_containers, app.id, CONVERSATION_VARIABLE_NODE_ID, fake.word(), test_value, fake=fake
)
@@ -515,7 +515,7 @@ class TestWorkflowDraftVariableService:
app = self._create_test_app(db_session_with_containers, mock_external_service_dependencies, fake=fake)
node_id = fake.word()
for i in range(2):
test_value = StringSegment(value=fake.numerify("node_value##"))
test_value = StringSegment(value=fake.numerify("node_value######"))
self._create_test_variable(
db_session_with_containers, app.id, node_id, fake.word(), test_value, "node", fake=fake
)

Loading…
Отказ
Запис