Conversation
Signed-off-by: Effi-S <effi.szt@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #2195
Several tests in
token/services/utils/retry_test.gofail intermittently on CI, in both theutest (unit-tests-race)andutest (unit-tests-regression)jobs. They are unrelated to whatever change is being tested, so they turn up as red on arbitrary PRs.Observed
Two different tests from the same family have failed on consecutive runs of the same branch:
Affected tests, all in
token/services/utils/retry_test.go:TestNewRetryRunnerWithJitter_NegativeJitterFactorTestNewRetryRunnerWithJitter_NegativeBackoffMultiplierTestNewRetryRunnerWithJitter_ExcessiveJitterFactor, which asserts on the same quantityWhy they are fragile
Each test drives a real retry runner with a 10 ms initial delay and a 2.0 multiplier, records wall-clock
timestamps around each attempt, then asserts on the ratio between consecutive measured intervals:
The intervals being compared are ~10 ms, ~20 ms and ~40 ms. A ratio of two measured durations is
roughly twice as sensitive to scheduler noise as either measurement, and a few milliseconds of delay
landing on one attempt but not its neighbour is enough to leave the ±0.5 band. On a shared runner —
especially under
-race, which inflates every timing — that is well within normal variation. Thetolerance is not a safety margin over a known worst case; it is a guess.
Note the tests are also insensitive to uniform slowdown, because stretching every interval equally
leaves the ratio intact. Only a single perturbed interval breaks them, which is exactly why the failures
look random and are hard to reproduce.
Impact
erodes trust in the signal.
Reproduction
Not reproduced locally: 24+ runs of the affected tests, including with
-raceand under saturating CPUload (96 busy loops on 32 cores), all passed. The load run took 269 s versus 6 s idle, so the tests were
heavily slowed without failing — consistent with the ratio being robust to uniform slowdown and
sensitive only to a single perturbed interval. Observed so far only on GitHub-hosted runners.
Suggested direction
These tests are trying to verify argument clamping — that a negative
backoffMultiplierdefaults to2.0, and a negative
jitterFactorclamps to 0.0. That is a pure input-validation property and does notneed a clock at all. Asserting on the runner’s computed delay sequence, rather than on measured
wall-clock time, would test the same behaviour deterministically. If timing coverage is wanted
separately, it should assert a generous lower bound on total elapsed time rather than a ratio between
adjacent samples.