Skip to content

Fix timing-sensitive broker test flakes - #218

Merged
rajp152k merged 2 commits into
mainfrom
rmq-publisher-confirm-flake
May 22, 2026
Merged

Fix timing-sensitive broker test flakes#218
rajp152k merged 2 commits into
mainfrom
rmq-publisher-confirm-flake

Conversation

@rajp152k

@rajp152k rajp152k commented May 19, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes the timing-sensitive broker test flakes tracked under #215.

RabbitMQ publisher confirms

The old test configured sync publisher confirms with :timeout-ms 1 and expected RabbitMQ to be slow enough to throw TimeoutException. RabbitMQ can legitimately confirm within 1ms, which made the test fail intermittently with actual: nil.

This replaces the wall-clock race with a deterministic timeout path by redefining langohr.confirm/wait-for-confirms to throw TimeoutException for this assertion.

Redis scheduled jobs range ordering

The old scheduled-jobs-get-by-range test created one job at (u/epoch-time-ms). scheduler/run-at compares that value against a fresh current time and moves past jobs directly to the ready queue, so the job could disappear from the scheduled sorted set if the clock advanced by 1ms.

This now uses two future timestamps for the ordering assertion, keeping both jobs in the scheduled sorted set deterministically.

Validation

  • clj-kondo --lint test/goose/brokers/redis/api_test.clj test/goose/brokers/rmq/integration_test.clj --fail-level error
  • clj -X:test :nses '[goose.brokers.redis.api-test goose.brokers.rmq.integration-test]'

@rajp152k rajp152k changed the title Make RMQ publisher confirm timeout test deterministic Fix timing-sensitive broker test flakes May 19, 2026

@ashutoshgngwr ashutoshgngwr left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@rajp152k
rajp152k merged commit 22a61d5 into main May 22, 2026
2 checks passed
@rajp152k
rajp152k deleted the rmq-publisher-confirm-flake branch May 22, 2026 11:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants