Skip to content

Commit

Permalink
fix: explain why a range check is used in the tests for IsRateLimiting
Browse files Browse the repository at this point in the history
  • Loading branch information
Robin Bryce committed Sep 19, 2024
1 parent c7f8718 commit 1c9c33c
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions massifs/bloberrors_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,9 @@ func TestIsRateLimiting(t *testing.T) {
t.Run(tt.name, func(t *testing.T) {

wait, result := IsRateLimiting(tt.err)
// Note: we use a range check here because parsing the Retry-After header
// uses time.Until, which then calls time.Now, in the case where the header is a date.
// this means this test would be flaky. We could mock time.Now but that would be a lot of work
if tt.minWait > 0 {
assert.GreaterOrEqual(t, wait, tt.minWait)
}
Expand Down

0 comments on commit 1c9c33c

Please sign in to comment.