Skip to content

Commit

Permalink
fix: accountBlob reservation no flaky (#1294)
Browse files Browse the repository at this point in the history
  • Loading branch information
hopeyen authored Feb 19, 2025
1 parent 1176999 commit 6d04a82
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions api/clients/v2/accountant_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -235,17 +235,13 @@ func TestAccountBlob_BinRotation(t *testing.T) {
assert.NoError(t, err)
assert.Equal(t, isRotation([]uint64{800, 0, 0}, mapRecordUsage(accountant.periodRecords)), true)

// next reservation duration
time.Sleep(1000 * time.Millisecond)

// Second call
now = time.Now().UnixNano()
now += int64(reservationWindow) * time.Second.Nanoseconds()
_, err = accountant.AccountBlob(ctx, now, 300, quorums)
assert.NoError(t, err)
assert.Equal(t, isRotation([]uint64{800, 300, 0}, mapRecordUsage(accountant.periodRecords)), true)

// Third call
now = time.Now().UnixNano()
_, err = accountant.AccountBlob(ctx, now, 500, quorums)
assert.NoError(t, err)
assert.Equal(t, isRotation([]uint64{800, 800, 0}, mapRecordUsage(accountant.periodRecords)), true)
Expand Down

0 comments on commit 6d04a82

Please sign in to comment.