Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
26 lines
664 B
Go
26 lines
664 B
Go
package store
|
|
|
|
import (
|
|
"testing"
|
|
"time"
|
|
)
|
|
|
|
func TestARemovedNodeIsRememberedWithItsLastRemoval(t *testing.T) {
|
|
db := capacityStore(t)
|
|
ctx := t.Context()
|
|
if at, err := db.NodeRevokedAt(ctx, "gpu01"); err != nil || !at.IsZero() {
|
|
t.Fatalf("never removed: %v, %v", at, err)
|
|
}
|
|
first := time.UnixMilli(1_700_000_000_000)
|
|
if err := db.RevokeNode(ctx, "gpu01", first); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
second := first.Add(time.Hour)
|
|
if err := db.RevokeNode(ctx, "gpu01", second); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
if at, err := db.NodeRevokedAt(ctx, "gpu01"); err != nil || !at.Equal(second) {
|
|
t.Errorf("got %v, %v; expected the second removal", at, err)
|
|
}
|
|
}
|