CI: Fix flaky `TestStartupInterrupt` and `FuzzParseOpenMetric` timeouts on contended runners
1. TestStartupInterrupt
Location: cmd/prometheus/main_unix_test.go
Failure
Should be true
prometheus didn't start in the specified timeoutRoot Cause
The test launches a real prometheus binary as a subprocess and polls:
http://localhost:<port>/graphevery 500 ms for 10 attempts (5 seconds total) before failing.
The test also uses t.Parallel(), so during go test -race ./... it competes with other tests for CPU time.
In the failing CI run, the environment reported:
GOMAXPROCS=4: CPU quota undefinedmeaning the runner's cgroup CPU limit was not detected, increasing scheduling contention on shared runners.
A fixed 5-second startup budget for:
- spawning the process,
- initializing TSDB,
- replaying WAL (if applicable), and
- binding the HTTP listener
can occasionally be insufficient under -race on a heavily loaded CI runner, resulting in a timeout despite Prometheus functioning correctly.
Suggested Fix
Increase the startup polling budget to provide more headroom on contended CI runners, for example by:
- increasing the number of polling attempts (e.g. from 10 to 20–30), or
- increasing the overall timeout.
2. FuzzParseOpenMetric
Location: util/fuzzing/fuzz_test.go
Failure
context deadline exceededRoot Cause
The failure is a timeout rather than a discovered crashing input.
Verification performed:
- Running the fuzz target standalone locally completed successfully.
- No crash reproducer exists under
testdata/fuzz/, which Go would automatically generate if a failing input had been found.
During the failing CI run:
FuzzParseOpenMetricandFuzzParseMetricTextboth executed for approximately four minutes.- Both continued discovering new coverage until the end of execution.
- One target completed just before the deadline and passed.
- The other exceeded the deadline slightly and was terminated with
context deadline exceeded.
This pattern is consistent with the overall test timeout being configured too close to the fuzzing duration (for example, -timeout=4m together with -fuzztime=4m), leaving little or no time for corpus write-out and cleanup after fuzzing completes.
Suggested Fix
Configure the overall test timeout to provide headroom beyond the fuzzing duration, for example:
-fuzztime=4m
-timeout=5m(or a larger timeout if appropriate).
Source: prometheus/prometheus