gateway tests: reservations crossing a window skip total, which has no boundary (#6165)

ab5824aee added "total" to access.Periods. TestKeyLimitReservationsStayInTheirWindow
loops over every period and moves the clock past the window's end, but a
total window runs from Since (or the epoch) for 100 years, so a reservation
made before the "boundary" is still in the same window after it, and the
test went red on total/tokens and total/cost. ab5824aee's run record covers
internal/access, budget, cli and provider, not internal/gateway.

The total window's own reservations are held by internal/budget's
total_test.go.

Run (mote): the old file is red on total/tokens and total/cost, the fixed
file passes -run TestKeyLimit, and the whole ./internal/gateway package
is ok (1001s, -tags nogui -count=1 -timeout 45m). gofmt clean.
This commit is contained in:
yetone
2026-11-12 00:09:38 +08:00
parent af3334533d
commit 535f0dd95f
+3
View File
@@ -252,6 +252,9 @@ func TestKeyLimitWindowResets(t *testing.T) {
// reservation. A late check or release of it cannot spend the new window.
func TestKeyLimitReservationsStayInTheirWindow(t *testing.T) {
for _, period := range access.Periods {
if period == "total" {
continue // one window that never ends: no boundary to cross (internal/budget's total_test.go holds it)
}
for _, cap := range []struct {
name string
tokens int64