diff --git a/internal/update/images_windows_test.go b/internal/update/images_windows_test.go index 56de6f0c..53cf5f8b 100644 --- a/internal/update/images_windows_test.go +++ b/internal/update/images_windows_test.go @@ -178,8 +178,13 @@ func TestImageGatesSurviveDirectorySwapAndRecovery(t *testing.T) { t.Error("update worker did not finish") } }) + // The two directories are looked at one after the other, not at once. swapIn first renames sdk\emulator + // to previous, then the stage to sdk\emulator; previous stays until finishInstall, which waits for + // metaLock. Looking at sdk\emulator first could see the old one just before the first rename and + // previous just after it, with sdk\emulator missing in between (ModAVD/ModAVD#403). Looking at + // previous first, sdk\emulator seen after it can only be the one the second rename put there. deadline := time.Now().Add(5 * time.Second) - for !isDir(u.l.emulator()) || !isDir(u.l.previousEmulator()) { + for !isDir(u.l.previousEmulator()) || !isDir(u.l.emulator()) { select { case <-done: t.Fatalf("update ended before metadata commit: %+v %v", result, updateErr)