Repository navigation
Stop more slow Go tests waiting on production timers - #2399
Conversation
The same treatment as internal/server's slowest tests, for the slowest tests elsewhere: Argo CD's 8s reachability probe timeout, Prometheus's 8s attribution and historical-partition proof budgets and the dynamic cache's 5s scope-walk budget become unexported package variables with unchanged defaults, shortened only by the tests that wait on them. MCP tests reuse the existing sync-wait, stall and enrichment-budget overrides, a Helm test client stops rate-limiting its mock SARs, and two fixtures start every informer before waiting for any of them to sync.
PR Summary by QodoShorten timer-bound Go tests without changing production defaults
AI Description
Diagram
High-Level Assessment
Files changed (14)
|
Code Review by Qodo🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0)
Great, no issues found!Qodo reviewed your code and found no material issues that require reviewTip of the day💡 Did you know, you can turn on the rule miner and Qodo learns your standards from review history |
Summary
Follow-up to the
internal/servertimer work: the slowest Go tests in the other packages also spent most of their time waiting on real production timers. Locally, the 11 tests changed here went from 130 s to 42 s. The largest isinternal/mcp'sTestResourceReadsDynamicPendingAndCollectorDenial, which drops from 54 s to 15 s. That takesinternal/mcp, the longest package in CI's Backend job, from about 143 s to 94 s locally. On CI, the Backend job's test step drops from 187–236 s on recent main runs to 148 s.What changed
Same pattern as before. A production duration becomes an unexported package variable with its default unchanged. Only the tests that wait on it shorten it, restoring it with
t.Cleanup, and they keep the ratios their assertions depend on.internal/argocd/manager.gointernal/prometheus/workload_attribution.gointernal/prometheus/workload_history.gopkg/k8score/dynamic_cache.go(unexported)QPS: -1): 4.4 s → 0.01 s.internal/issues,internal/k8sTraefik) start every informer before waiting for any to sync, instead of syncing them one after another.mcpTestResourceReadsDynamicPendingAndCollectorDenialissuesTestStuckDeletionCleanupNeedsNoRecognizedControllerprometheusTestHistoricalPartitionDiscoveryHasSeparateBudgetprometheusTestAttributionWaitsForDiscoveryBeforeProbeDeadlineargocdTestSlowRecheck_LeavesNoFailureBehindk8scoreTestWalkOutOfTimeIsNotADenialmcpTestAgentMCPListBoundsSlowOwnershipAuthorizationk8sTestDetectLiveTraefikMissingRefsShadowedRoutermcpTestResourceReadsDynamicStallIsPerNamespacehelmTestRequireHelmWrite_ChecksCallerInNamespacek8scoreTestRequestDeadlines_StalledInformerListRecoversLeft as they are
pkg/k8score's hard-coded 2 s cache-miss wait. Shortening it frominternal/needs new exported API inpkg/, which Radar Hub imports, so it isn't in this PR.internal/cnpglog-follow tests (5–10 s each). They callt.Parallel()and share the discovery interval with other parallel tests, so overriding it isn't safe. They already overlap each other.Testing
go vetis clean.pkgjob is unchanged (70 s against 66–77 s): its long pole is elsewhere inpkg/k8score.