Skip to content

Commit 6a5adbb

Browse files
whummerclaude
andcommitted
fix race condition in insights query test status comparison
Query status can change between proxy and direct AWS calls, so just verify both return valid statuses rather than comparing exact values. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent a6fd6d4 commit 6a5adbb

1 file changed

Lines changed: 5 additions & 10 deletions

File tree

aws-proxy/tests/proxy/test_cloudwatch.py

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -586,17 +586,12 @@ def test_logs_readonly_insights_query(start_aws_proxy, cleanups):
586586
# The fact that we get a valid status proves the request was proxied to AWS
587587
results = logs_client.get_query_results(queryId=query_id)
588588
assert "status" in results
589-
assert results["status"] in [
590-
"Scheduled",
591-
"Running",
592-
"Complete",
593-
"Failed",
594-
"Cancelled",
595-
]
596-
597-
# Verify via AWS client that the query exists (same query ID)
589+
valid_statuses = ["Scheduled", "Running", "Complete", "Failed", "Cancelled"]
590+
assert results["status"] in valid_statuses
591+
592+
# Verify via AWS client that the query exists (same query ID returns valid response)
598593
results_aws = logs_client_aws.get_query_results(queryId=query_id)
599-
assert results_aws["status"] == results["status"]
594+
assert results_aws["status"] in valid_statuses
600595

601596

602597
def test_logs_resource_name_matching(start_aws_proxy, cleanups):

0 commit comments

Comments
 (0)