From 8400976e8099a9fccdffdfedf5b0adc19e935796 Mon Sep 17 00:00:00 2001 From: rcourtman Date: Thu, 18 Dec 2025 22:48:15 +0000 Subject: [PATCH] fix: wait for async save in guest metadata test The TestGuestMetadataStore_GetWithLegacyMigration_ClusteredMatchesNodeFormat test was flaky because it triggered an async save in GetWithLegacyMigration but didn't wait for it to complete. When the test ended, t.TempDir() tried to clean up while the goroutine was still writing, causing 'directory not empty' errors on CI. Added time.Sleep(100ms) to wait for the async save, matching the pattern used in other similar tests in the same file. --- internal/config/guest_metadata_test.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/internal/config/guest_metadata_test.go b/internal/config/guest_metadata_test.go index 121b8fb6a..ce9959c91 100644 --- a/internal/config/guest_metadata_test.go +++ b/internal/config/guest_metadata_test.go @@ -647,6 +647,9 @@ func TestGuestMetadataStore_GetWithLegacyMigration_ClusteredMatchesNodeFormat(t if result.ID != "pve1:node1:100" { t.Errorf("ID = %q, want %q", result.ID, "pve1:node1:100") } + + // Wait for async save to complete before test cleanup + time.Sleep(100 * time.Millisecond) } func TestGuestMetadataStore_GetWithLegacyMigration_ConcurrentMigration(t *testing.T) {