fix(macos): pass the runtime QMP socket to the suspend probe
Complete the merge with main so the suspend probe and the cold-start probe resolve the same socket, and keep the architecture tests honest after the atomicfile refactor moved the suspend commit's os.Rename into the platform file-operation helpers. - startprep: query the VM status through qmp.SocketPathForVM instead of the VM-directory socket, so long-path VMs stop failing the probe. - qmp: drop the uncalled QueryStatusVM wrapper; QueryStatusAt is the one product entry, and its test now exercises it directly. - archtest: list the two suspend_fileops files as the rename owners that suspend_transaction.go handed its os.Rename calls to. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
65553e48f7
commit
965e03ca34
3 files changed
+22
-26
No files matched your search
@@ -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) {
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in new issue
Block a user