From 223c1a80895ccb721910d8da632ee49eb0326da7 Mon Sep 17 00:00:00 2001 From: QuantumGhost Date: Mon, 11 Aug 2025 17:39:58 +0800 Subject: [PATCH] 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. --- .../services/test_workflow_draft_variable_service.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/api/tests/test_containers_integration_tests/services/test_workflow_draft_variable_service.py b/api/tests/test_containers_integration_tests/services/test_workflow_draft_variable_service.py index 85a9355c7..1d1cef6ee 100644 --- a/api/tests/test_containers_integration_tests/services/test_workflow_draft_variable_service.py +++ b/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 )