fix: the AcoustID rate-limit test bounds arrivals by the service's 3 a second, not the client's send spacing
release / govulncheck (push) Successful in 14s
release / web (push) Successful in 1m22s
release / go (push) Successful in 1m42s
release / integration (push) Successful in 5m19s
release / android (push) Successful in 5m26s
release / Build signed APK (releases and dev) (push) Successful in 5m31s
release / Attach APK to the Release (tag releases only) (push) Skipped
release / Build + push container image (push) Successful in 24s
release / Verify release artifacts (tag releases only) (push) Skipped
release / govulncheck (push) Successful in 14s
release / web (push) Successful in 1m22s
release / go (push) Successful in 1m42s
release / integration (push) Successful in 5m19s
release / android (push) Successful in 5m26s
release / Build signed APK (releases and dev) (push) Successful in 5m31s
release / Attach APK to the Release (tag releases only) (push) Skipped
release / Build + push container image (push) Successful in 24s
release / Verify release artifacts (tag releases only) (push) Skipped
Run 9543 saw two arrivals 389ms apart though the client sent them 400ms apart. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -198,10 +198,14 @@ func TestLookup_KeepsToTheRateLimit(t *testing.T) {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
// The client spaces its sends by minInterval; the server sees arrivals,
|
||||
// which transit can bunch by a few milliseconds (389ms under -race, CI run
|
||||
// 9543). What AcoustID enforces is 3 a second at its end, so that is the
|
||||
// bound: minInterval's headroom is what absorbs the bunching.
|
||||
const serviceLimit = time.Second / 3
|
||||
for i := 1; i < len(at); i++ {
|
||||
// A little slack for the server's own clock reading.
|
||||
if gap := at[i].Sub(at[i-1]); gap < minInterval-10*time.Millisecond {
|
||||
t.Errorf("requests %d and %d were %s apart, want at least %s", i-1, i, gap, minInterval)
|
||||
if gap := at[i].Sub(at[i-1]); gap < serviceLimit {
|
||||
t.Errorf("requests %d and %d arrived %s apart, want at least %s", i-1, i, gap, serviceLimit)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user