test: fix flaky KubernetesTaskRunnerTest start tests #20316
All Vouch review confidence checks passed
Residual risk 0.25 = Change Risk (0.62) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.62 · 261 lines diff across 3 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.333
Shallow Review Depth
shallow_review_depth
0.289
Sensitive Paths
sensitive_paths
0.062
Real PR Conversation Timeline
1 comments
"Review active on #20316"
general
weight: 0.35
GWphua
Related to #20312 (item 1).
Description
KubernetesTaskRunnerTest.test_start_whenDeserializationExceptionThrown_isIgnoredfails intermittently on master with:Example: https://github.com/apache/druid/actions/runs/34431507380/job/102727804299 (failed all 4 surefire attempts).
KubernetesTaskRunner.start()schedulesdeleteCompletedPeonJobsOlderThanon a realScheduledExecutorServicewith an initial delay of 1 ms. Whether the first cleanup runs before the test'sverifyAll()depends on thread scheduling, so the strict mock sometimes sees a call it was not told to expect.Changes
In the three tests that call
runner.start()on a locally created runner, expectdeleteCompletedPeonJobsOlderThan(anyLong(), MILLISECONDS)any number of times via a small helper. Only this one call is relaxed; the rest ofpeonClientstays strictly verified.Stop each locally created runner in a
finallyblock so the cleanup executor does not outlive the test.Verified locally with
mvn -pl extensions-core/kubernetes-overlord-extensions test -Dtest=KubernetesTaskRunnerTest.<hr>
##### Key changed/added classes in this PR
*
KubernetesTaskRunnerTest<hr>
This PR has:
Additional CI evidence
This same scheduled-cleanup race reappeared as a recovered flaky failure in PR #20330, unit-test job:
The corresponding PR #20329 unit run did not reach this assertion: its embedded tests failed earlier with
NoClassDefFoundError: org/apache/curator/test/TestingServerafter thecurator-testdependency was removed.