Skip to content

Commit 96dcd06

Browse files
authored
Merge pull request #3844 from dimagi/cs/fix_failing_test
test: fix two flaky tests that fail intermittently in CI
2 parents aac1f5c + 73af204 commit 96dcd06

2 files changed

Lines changed: 4 additions & 6 deletions

File tree

apps/pipelines/tests/test_add_start_end_nodes.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -258,9 +258,7 @@ def test_remove_start_end_nodes(team):
258258
remove_all_start_end_nodes(Node)
259259
pipeline.refresh_from_db()
260260

261-
assert pipeline.node_set.all().count() == 2
262-
assert pipeline.node_set.all()[0].flow_id == passthrough_1["id"]
263-
assert pipeline.node_set.all()[1].flow_id == passthrough_2["id"]
261+
assert set(pipeline.node_set.values_list("flow_id", flat=True)) == {passthrough_1["id"], passthrough_2["id"]}
264262
assert len(pipeline.data["edges"]) == 1
265263
assert pipeline.data["edges"][0] == {
266264
"id": "1->2",

apps/service_providers/tests/test_langfuse_client_manager.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,12 +99,12 @@ def test_prune_stale_clients(client_manager, config, langfuse_mock):
9999
# Arrange
100100
other_config = {"public_key": "other_key", "secret_key": "other_secret"}
101101
first_client = client_manager.get(config)
102-
103-
time.sleep(0.4)
104102
client_manager.get(other_config) # Get second client
105103
assert len(client_manager.key_timestamps) == 2
106104

107-
time.sleep(0.1) # Sleep longer than the stale timeout
105+
# Backdate the first client so only it is past the stale timeout
106+
client_manager.key_timestamps[config["public_key"]] -= client_manager.stale_timeout + 1
107+
108108
client_manager._prune_stale()
109109

110110
assert len(client_manager.key_timestamps) == 1

0 commit comments

Comments
 (0)