Skip to content

Commit

Permalink
[dagster-aws] stabilize flaky cloudwatch message reader test (#26227)
Browse files Browse the repository at this point in the history
## Summary & Motivation

Looks like Moto's `put_log_events` does not guarantee correct ordering for multiple calls.
  • Loading branch information
danielgafni authored Dec 3, 2024
1 parent c40a6b7 commit 3470415
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -457,6 +457,8 @@ def test_cloudwatch_logs_reader(cloudwatch_client: "CloudWatchLogsClient", capsy
logEvents=[{"timestamp": int(datetime.now().timestamp() * 1000), "message": "1"}],
)

time.sleep(0.1)

assert reader.target_is_readable(
{"log_group": log_group, "log_stream": log_stream}
), "Should be able to read after the stream is created"
Expand All @@ -474,6 +476,8 @@ def test_cloudwatch_logs_reader(cloudwatch_client: "CloudWatchLogsClient", capsy
],
)

time.sleep(0.1)

cloudwatch_client.put_log_events(
logGroupName=log_group,
logStreamName=log_stream,
Expand All @@ -485,6 +489,8 @@ def test_cloudwatch_logs_reader(cloudwatch_client: "CloudWatchLogsClient", capsy
],
)

time.sleep(0.1)

is_session_closed.set()

time.sleep(1)
Expand Down

0 comments on commit 3470415

Please sign in to comment.