-
Notifications
You must be signed in to change notification settings - Fork 1.4k
🐛 Fix race condition in InMemoryMachine controller tests #12347
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
Conversation
9dcf6df
to
21b1255
Compare
test result of d290d64:
|
a2a4c58
to
a229543
Compare
/assign |
/area testing |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you very much!!
Sorry for the delay. Two nits, then happy to merge :)
...rastructure/docker/internal/controllers/backends/inmemory/inmemorymachine_controller_test.go
Show resolved
Hide resolved
...rastructure/docker/internal/controllers/backends/inmemory/inmemorymachine_controller_test.go
Outdated
Show resolved
Hide resolved
a229543
to
746d78f
Compare
Thanks again! That one was really annoying :) /lgtm |
LGTM label has been added. Git tree hash: 542efc17fdf9753194cf86cfd9af01dde64d315a
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: sbueringer The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
What this PR does / why we need it:
Error:
The controller returned ctrl.Result{} (no requeue) too early.
The test expects a requeue ctrl.Result{RequeueAfter: ...} until the provisioning duration has finished.
If res is equal to 0 then reconciliation will not be requeued, but it should be requeued and equal to 0.
if now < until then res != 0 and we requeue
if now >= until then res == 0 and we do not requeue (provisioned)
Problem:
Test setup took longer than provisioning duration causing the controller to think provisioning is completed when the test expected it to still be incomplete. Controller uses
LastTransitionTime
ofNodeProvisionedCondition
to determine if provisioning time is completed but this timestamp is out of date by the time test setup finishes.Fix:
Added a helper function that updates the
LastTransitionTime
to current time right before calling the reconciler. Note that the helper function handles both current and deprecated status structures because we are migrating in between API versions until approximately August 2026.Verification:
@mboersma and I ran this fix with a test script for multiple days and didn't get the error.
Which issue(s) this PR fixes:
Fixes #12301