Skip to content

Commit 62a2645

Browse files
committed
fixed test
1 parent fd3bff6 commit 62a2645

File tree

2 files changed

+40
-14
lines changed

2 files changed

+40
-14
lines changed

osversion_arm64_test.go

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ package vz
66
import (
77
"context"
88
"errors"
9+
"os"
10+
"path/filepath"
911
"sync"
1012
"testing"
1113
)
@@ -94,4 +96,42 @@ func TestAvailableVersionArm64(t *testing.T) {
9496
}
9597
}
9698
})
99+
100+
t.Run("macOS 14", func(t *testing.T) {
101+
if macOSBuildTargetAvailable(14) != nil {
102+
t.Skip("disabled build target for macOS 13")
103+
}
104+
105+
dir := t.TempDir()
106+
filename := filepath.Join(dir, "tmpfile.txt")
107+
f, err := os.Create(filename)
108+
if err != nil {
109+
t.Fatal(err)
110+
}
111+
defer f.Close()
112+
113+
majorMinorVersion = 13
114+
cases := map[string]func() error{
115+
"NewLinuxRosettaUnixSocketCachingOptions": func() error {
116+
_, err := NewLinuxRosettaUnixSocketCachingOptions(filename)
117+
return err
118+
},
119+
"NewLinuxRosettaAbstractSocketCachingOptions": func() error {
120+
_, err := NewLinuxRosettaAbstractSocketCachingOptions("datagram")
121+
return err
122+
},
123+
"SaveMachineStateToPath": func() error {
124+
return (*VirtualMachine)(nil).SaveMachineStateToPath(filename)
125+
},
126+
"RestoreMachineStateFromURL": func() error {
127+
return (*VirtualMachine)(nil).RestoreMachineStateFromURL(filename)
128+
},
129+
}
130+
for name, fn := range cases {
131+
err := fn()
132+
if !errors.Is(err, ErrUnsupportedOSVersion) {
133+
t.Fatalf("unexpected error %v in %s", err, name)
134+
}
135+
}
136+
})
97137
}

osversion_test.go

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -311,14 +311,6 @@ func TestAvailableVersion(t *testing.T) {
311311

312312
majorMinorVersion = 13
313313
cases := map[string]func() error{
314-
"NewLinuxRosettaUnixSocketCachingOptions": func() error {
315-
_, err := NewLinuxRosettaUnixSocketCachingOptions(filename)
316-
return err
317-
},
318-
"NewLinuxRosettaAbstractSocketCachingOptions": func() error {
319-
_, err := NewLinuxRosettaAbstractSocketCachingOptions("datagram")
320-
return err
321-
},
322314
"NewNVMExpressControllerDeviceConfiguration": func() error {
323315
_, err := NewNVMExpressControllerDeviceConfiguration(nil)
324316
return err
@@ -327,12 +319,6 @@ func TestAvailableVersion(t *testing.T) {
327319
_, err := NewDiskBlockDeviceStorageDeviceAttachment(nil, false, DiskSynchronizationModeFull)
328320
return err
329321
},
330-
"SaveMachineStateToPath": func() error {
331-
return (*VirtualMachine)(nil).SaveMachineStateToPath(filename)
332-
},
333-
"RestoreMachineStateFromURL": func() error {
334-
return (*VirtualMachine)(nil).RestoreMachineStateFromURL(filename)
335-
},
336322
}
337323
for name, fn := range cases {
338324
t.Run(name, func(t *testing.T) {

0 commit comments

Comments
 (0)