-
Notifications
You must be signed in to change notification settings - Fork 235
test: fix flakes in controller and registry tests #2250
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Fixes two critical test flakes: 1. Controller: Mismatch between FakeClock and RealClock in `OnReqCtxTimeoutAfterDistribution`. 2. Registry: Race condition between background GC and manual GC in `ShouldCollectIdleFlow`.
|
@LukeAVanDrie: The label(s) DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
✅ Deploy Preview for gateway-api-inference-extension ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
/lgtm |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: ahg-g, LukeAVanDrie The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
/retest |
What type of PR is this?
/kind flake
What this PR does / why we need it:
Fixes two test flakes in the Flow Control layer (
TestFlowController_EnqueueAndWaitandTestFlowRegistry_GarbageCollection).OnReqCtxTimeoutAfterDistributionused a frozenFakeClockfor the request timestamp butcontext.WithDeadline(which uses the system wall clock) for the deadline. CI/CD latency or slow startup (simulated locally with a35mssleep) caused the deadline to expire immediately relative to wall time, failing the test.newUnitHarnessto accept options and injectedclock.RealClock{}for this specific test case. This ensures the request timestamp and deadline check rely on the same time source.TestFlowRegistry_GarbageCollection/ShouldCollectIdleFlowfailed intermittently because the background GC loop (enabled by default) raced with the test’s manual GC trigger. This sometimes caused the flow to be collected before the test asserted its state.manualGC: truefor this test case, preventing the background loop from interfering with deterministic test steps.Reproduced flakes and verified fixes by injecting
time.Sleep(35 * time.Millisecond)intonewUnitHarness(for the controller test) and running:Which issue(s) this PR fixes:
Fixes #2248
Fixes #2249
Does this PR introduce a user-facing change?: