From f3d9f426c520242a2ab91da9d7a84d7e963070ea Mon Sep 17 00:00:00 2001 From: rcourtman Date: Fri, 26 Jun 2026 17:06:02 +0100 Subject: [PATCH] test: fix 60s hang in canonical store refresh test MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- internal/monitoring/monitor_backups_readstate_test.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/internal/monitoring/monitor_backups_readstate_test.go b/internal/monitoring/monitor_backups_readstate_test.go index d71e6240f..205170fe0 100644 --- a/internal/monitoring/monitor_backups_readstate_test.go +++ b/internal/monitoring/monitor_backups_readstate_test.go @@ -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")