Fix flaky "enqueue event for wrong name" Ready test #1085
All Vouch review confidence checks passed
Residual risk 0.18 = Change Risk (0.45) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.45 · 422 lines diff across 5 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.362
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #1085"
general
weight: 0.35
wallrj
This fixes a test that has failed 4 of the last 9 completed runs of
pull-cert-manager-approver-policy-teston #1076, #1077 and #1083. It changes test code only. The follow-up for the controller is #1086.What went wrong
The spec "After enqueue event but for wrong name, should not change returning not-ready" does this:
1. Waits for the policy to become not-ready.
2. Flips plugin 2 to report ready.
3. Sends an enqueue event for a different policy name.
4. Expects the policy to stay not-ready for 10 seconds.
The controller watches the policy without a predicate, so it reconciles the policy again in response to its own status update. When that reconcile runs after step 2, it marks the policy ready and the test fails. The enqueue event is not involved.
The fix
The test now waits until plugin 2 has been called twice, and then has not been called for one second, before it flips plugin 2 to ready. The two calls are the reconcile for the create and the reconcile for the controller's own status update.
The quiet second is only a guard against a third reconcile, which I do not expect. #1086 proposes that the controller ignore its own status updates. The wait can be deleted when that is fixed.
The second commit addresses review findings in the other Ready specs:
Readyfuncs. The specs used to replace each plugin's fake reconciler while the controllers were running.How I tested it
<details>
<summary>Evidence</summary>
The unmodified test passed 30 of 30 runs on my machine, so I could not reproduce the failure by repetition. Instead I added a 100ms sleep to plugin 2's second and later calls, which delays the controller's second reconcile:
| Version | Result with the sleep |
|---|---|
| Test on
main| Failed on the first run with "expected the condition to maintain not-ready" || Test in this PR | Passed 3 of 3 |
The full controller suite passes with both commits (50 of 50 specs). The Ready specs also pass with
--race(19 of 19). The race detector reports one race, in the cert-manager test webhook server, which is unrelated to this change. It reports the same race without the second commit.Failing CI runs:
In the first log the controller reconciles the policy a second time, reports
ready=true, and the assertion fails 10ms later.</details>
Not covered
/kind flake
[Claude Fable 5.2]