test(kubernetes): use testing/synctest in the autoscaler controllers and device plugin tests #61404
All Vouch review confidence checks passed
Residual risk 0.35 = Change Risk (0.66) × (1 − Review Confidence (0.47)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.66 · 354 lines diff across 4 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.02 · 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.351
Shallow Review Depth
shallow_review_depth
0.344
Sensitive Paths
sensitive_paths
0.066
Real PR Conversation Timeline
1 comments
"Review active on #61404"
general
weight: 0.35
L3n41c
What does this PR do?
Runs the timing-sensitive unit tests below in
testing/synctestbubbles:Eventually/EventuallyWithTpolling,time.Sleepandtime.Afterguards are replaced by the bubble's fake clock andsynctest.Wait()followed by a direct assertion.Code owners of every file touched: container-integrations + container-platform + kubernetes-experiences (per
CODEOWNERS).pkg/util/kubernetes/apiserver/controllers/hpa_controller_test.gopkg/util/kubernetes/apiserver/controllers/store_test.gopkg/util/kubernetes/apiserver/controllers/wpa_controller_test.gopkg/util/kubernetes/kubelet/deviceplugin_test.goThis PR is one of a series (one PR per set of co-maintainers) that replaces the single, larger draft #61285.
Motivation
Faster, deterministic and less flaky tests: no more real-time waiting or polling in these tests.
Describe how you validated your changes
dda inv teston the touched packages, from this branch only (rebased onmain).Execution time of the modified tests, before (
main) and after (this branch). Measured withdda inv test --targets=<pkgs> --bazel-args="--nocache_test_results --runs_per_test=3 --local_test_jobs=1":tests really run (no
(cached)result), 3 runs per target, tests executed one at a time, median of the 3 runs read from each target'stest.xml(only files written after the start of the measurement were considered). Resolution is 10 ms.
| Test | Package | Before (s) | After (s) | Note |
|---|---|---:|---:|---|
|
TestAutoscalerController| pkg/util/kubernetes/apiserver/controllers | 0.62 | 0.02 | ||
TestAutoscalerControllerLegacyHPAVersions| pkg/util/kubernetes/apiserver/controllers | 0.04 | 0.03 | ||
TestWPAController| pkg/util/kubernetes/apiserver/controllers | 0.62 | 0.02 | ||
TestCachedDevicePluginClient| pkg/util/kubernetes/kubelet | 1.00 | < 0.01 | (first of 3 build flavors:kubelet_test_cel_docker_kubelet) || Sum of the tests above | | 2.28 | 0.07 | |
Reading the numbers:
TestAutoscalerControllerandTestWPAControllerusedEventuallyWithTwith a 500 ms poll interval;TestCachedDevicePluginClientslept for the real 1 s cache timeout. Not in the table:store_test.goonly changes theassertNotified/assertNotNotifiedhelpers (non-blockingselectsince the store notifies synchronously, instead of a 50 ms sleep and a 1 s timeout), used by tests that were already below 10 ms in aggregate. The tests that need real I/O (resourcetypes_test.go, the HTTPS retry inkubelet_test.go, the unix-socket/gRPC device plugin tests) are deliberately not migrated.Additional Notes
Test-only change (plus the production change described above, if any); no functional impact on the Agent.
🤖 Generated with Claude Code