diff --git a/internal/archtest/file_replace_test.go b/internal/archtest/file_replace_test.go index e6d1056..309aa2d 100644 --- a/internal/archtest/file_replace_test.go +++ b/internal/archtest/file_replace_test.go @@ -9,24 +9,25 @@ import ( // download too large for memory, a rotated log, the running executable, or // several files that must change together. var renameOwners = map[string]bool{ - "internal/app/guesttools_flow.go": true, // file copied into the shared folder - "internal/app/ui_health.go": true, // log rotation - "internal/atomicfile/atomicfile.go": true, - "internal/fetch/fetch.go": true, // download - "internal/macos/installer/accelerated.go": true, // download - "internal/macos/installer/hfs_image.go": true, // disk image - "internal/macos/installer/oc_cache.go": true, // download - "internal/macos/installer/recovery.go": true, // download - "internal/macos/installguide/progress.go": true, // macOS may not import atomicfile, see macosHostImports - "internal/macos/reims/network_record.go": true, // same - "internal/macos/opencore/image.go": true, // disk image with rollback - "internal/macos/reims/disk_import.go": true, // disk image with rollback - "internal/macos/reims/suspend_transaction.go": true, // state and metadata commit together - "internal/plugin/broker.go": true, // log rotation - "internal/plugin/pack.go": true, // archive - "internal/plugin/package.go": true, // plugin directory - "internal/runtime/runtime.go": true, // runtime directory - "internal/selfupdate/selfupdate.go": true, // running executable + "internal/app/guesttools_flow.go": true, // file copied into the shared folder + "internal/app/ui_health.go": true, // log rotation + "internal/atomicfile/atomicfile.go": true, + "internal/fetch/fetch.go": true, // download + "internal/macos/installer/accelerated.go": true, // download + "internal/macos/installer/hfs_image.go": true, // disk image + "internal/macos/installer/oc_cache.go": true, // download + "internal/macos/installer/recovery.go": true, // download + "internal/macos/installguide/progress.go": true, // macOS may not import atomicfile, see macosHostImports + "internal/macos/reims/network_record.go": true, // same + "internal/macos/opencore/image.go": true, // disk image with rollback + "internal/macos/reims/disk_import.go": true, // disk image with rollback + "internal/macos/reims/suspend_fileops_other.go": true, // state and metadata commit together + "internal/macos/reims/suspend_fileops_windows.go": true, // state and metadata commit together + "internal/plugin/broker.go": true, // log rotation + "internal/plugin/pack.go": true, // archive + "internal/plugin/package.go": true, // plugin directory + "internal/runtime/runtime.go": true, // runtime directory + "internal/selfupdate/selfupdate.go": true, // running executable } func TestSmallFilesAreReplacedThroughAtomicfile(t *testing.T) { diff --git a/internal/qmp/migrate.go b/internal/qmp/migrate.go index 19e9a31..5e2849a 100644 --- a/internal/qmp/migrate.go +++ b/internal/qmp/migrate.go @@ -267,11 +267,6 @@ func fileChannels(vmstatePath string) []map[string]any { } } -// QueryStatusVM reads the VM's execution state without changing it. -func QueryStatusVM(ctx context.Context, vmDir string) (VMStatus, error) { - return QueryStatusAt(ctx, SocketPath(vmDir)) -} - // QueryStatusAt reads the VM's execution state at the given Unix socket. func QueryStatusAt(ctx context.Context, socketPath string) (VMStatus, error) { deadline, _ := ctx.Deadline() diff --git a/internal/qmp/migrate_test.go b/internal/qmp/migrate_test.go index d4eb9df..8821c77 100644 --- a/internal/qmp/migrate_test.go +++ b/internal/qmp/migrate_test.go @@ -15,7 +15,7 @@ import ( "time" ) -func TestQueryStatusVM(t *testing.T) { +func TestQueryStatusAt(t *testing.T) { t.Chdir(t.TempDir()) socket := SocketPath(".") for _, tt := range []struct { @@ -34,7 +34,7 @@ func TestQueryStatusVM(t *testing.T) { } return map[string]any{"return": tt.state}, false }) - got, err := QueryStatusVM(context.Background(), ".") + got, err := QueryStatusAt(context.Background(), socket) if tt.err != "" { if err == nil || !strings.Contains(err.Error(), tt.err) { t.Fatalf("query status = %v, want %q", err, tt.err) @@ -54,7 +54,7 @@ func TestQueryStatusVM(t *testing.T) { ctx, cancel := context.WithTimeout(t.Context(), 250*time.Millisecond) defer cancel() start := time.Now() - if _, err := QueryStatusVM(ctx, "."); !errors.Is(err, os.ErrDeadlineExceeded) { + if _, err := QueryStatusAt(ctx, socket); !errors.Is(err, os.ErrDeadlineExceeded) { t.Fatalf("query status = %v, want deadline exceeded", err) } if elapsed := time.Since(start); elapsed > 2*time.Second {