test: fix 60s hang in canonical store refresh test

TestMonitorPollGuestSnapshots_RefreshesStaleCanonicalStoreForClusterGuest
passed context.Background() to pollGuestSnapshots, which creates an
internal 60s snapshot timeout. The backupStorageTimeoutSnapshotClient
mock blocks GetStorage until context cancellation, so the test wasted
60s waiting for the timeout to expire. Pass a 200ms deadline context
so pollGuestSnapshots caps its budget down — test now runs in 0.2s
instead of 60s and no longer times out under -race.
This commit is contained in:
rcourtman 2026-06-26 17:06:02 +01:00
parent 3773749281
commit f3d9f426c5

View file

@ -225,7 +225,9 @@ func TestMonitorPollGuestSnapshots_RefreshesStaleCanonicalStoreForClusterGuest(t
}},
}
m.pollGuestSnapshots(context.Background(), "homelab", client)
ctx, cancel := context.WithTimeout(context.Background(), 200*time.Millisecond)
defer cancel()
m.pollGuestSnapshots(ctx, "homelab", client)
if client.snapshotCalls == 0 {
t.Fatal("expected guest snapshot polling to use fresh clustered guest state")