test: harden TestE2E_PushDLQLifecycle against CI load#185
Open
7schmiede wants to merge 1 commit into
Open
Conversation
The re-delivery check snapshotted deliveryCount *after* pd2.Start(), so under load pd2 could re-deliver the requeued message before the snapshot was taken, leaving the busy-poll waiting forever (observed "deliveryCount=3, before=3" timeout on loaded runners). Replace the racing sleep-poll with a deterministic signal: the target handler sends on a buffered channel on the successful (n>=3) delivery, which is exactly the re-delivery of the requeued message. Wait on that channel with a 30s safety bound instead of a fixed wall-clock budget. Also bump the downstream queue-empty deadline 5s -> 15s so the flake is not relocated there. Test-harness robustness only; no dispatcher behavior change. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
TestE2E_PushDLQLifecycleintermittently fails on loaded CI runners (ubuntu-latest) with:Root cause is a TOCTOU race in the test harness, not a too-short deadline. The re-delivery check snapshotted
beforeRequeueDeliveries := deliveryCount.Load()afterpd2.Start(), so under load pd2 could re-deliver the requeued message (n=3β success β count becomes 3) before the snapshot was taken. The busy-poll then waited forever forcount > 3, which explains thebefore=3, deliveryCount=3timeout. Simply raising the deadline would not have fixed this.Change
n>=3) delivery β which is exactly the re-delivery of the requeued message. The test waits on that channel with a 30s safety bound instead of racing a fixed wall-clock budget.beforeRequeueDeliveriessnapshot.The assertion stays meaningful β the requeued message must be re-delivered, or the test fails.
Scope
Test-harness robustness only. No dispatcher behavior change.
Verification
go vet ./internal/e2e/β cleango test ./internal/e2e/ -run TestE2E_PushDLQLifecycle -count=5β passes all 5π€ Generated with Claude Code