Skip to content

Commit

Permalink
chore: make test more clear
Browse files Browse the repository at this point in the history
  • Loading branch information
Chris Stockton committed Jan 27, 2025
1 parent be8f71e commit 8ef3807
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions internal/ratelimit/burst_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,9 @@ func TestBurstLimiter(t *testing.T) {
type event struct {
ok bool
at time.Time
r int

// Event should be `ok` at `at` for `i` times
i int
}

type testCase struct {
Expand Down Expand Up @@ -176,7 +178,7 @@ func TestBurstLimiter(t *testing.T) {
for _, tc := range cases {
rl := NewBurstLimiter(tc.cfg)
for _, evt := range tc.evts {
for i := 0; i <= evt.r; i++ {
for i := 0; i <= evt.i; i++ {
if exp, got := evt.ok, rl.AllowAt(evt.at); exp != got {
t.Fatalf("exp AllowAt(%v) to be %v; got %v", evt.at, exp, got)
}
Expand Down

0 comments on commit 8ef3807

Please sign in to comment.