-
Notifications
You must be signed in to change notification settings - Fork 202
/
machine_test.go
61 lines (47 loc) · 1.63 KB
/
machine_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
package machine
import (
. "github.com/onsi/ginkgo/v2"
"github.com/onsi/gomega"
)
var _ = Describe("Machine", func() {
BeforeEach(func() {
// disable normal init for testing
markerSync.Do(func() {})
})
It("not a machine", func() {
loadMachineMarker("testdata/does-not-exist")
gomega.Expect(IsPodmanMachine()).To(gomega.BeFalse())
gomega.Expect(HostType()).To(gomega.BeEmpty())
gomega.Expect(IsGvProxyBased()).To(gomega.BeFalse())
})
It("generic machine", func() {
loadMachineMarker("testdata/empty-machine")
gomega.Expect(IsPodmanMachine()).To(gomega.BeTrue())
gomega.Expect(HostType()).To(gomega.BeEmpty())
gomega.Expect(IsGvProxyBased()).To(gomega.BeTrue())
})
It("wsl machine", func() {
loadMachineMarker("testdata/wsl-machine")
gomega.Expect(IsPodmanMachine()).To(gomega.BeTrue())
gomega.Expect(HostType()).To(gomega.Equal(Wsl))
gomega.Expect(IsGvProxyBased()).To(gomega.BeFalse())
})
It("qemu machine", func() {
loadMachineMarker("testdata/qemu-machine")
gomega.Expect(IsPodmanMachine()).To(gomega.BeTrue())
gomega.Expect(HostType()).To(gomega.Equal(Qemu))
gomega.Expect(IsGvProxyBased()).To(gomega.BeTrue())
})
It("applehv machine", func() {
loadMachineMarker("testdata/applehv-machine")
gomega.Expect(IsPodmanMachine()).To(gomega.BeTrue())
gomega.Expect(HostType()).To(gomega.Equal(AppleHV))
gomega.Expect(IsGvProxyBased()).To(gomega.BeTrue())
})
It("hyperv machine", func() {
loadMachineMarker("testdata/hyperv-machine")
gomega.Expect(IsPodmanMachine()).To(gomega.BeTrue())
gomega.Expect(HostType()).To(gomega.Equal(HyperV))
gomega.Expect(IsGvProxyBased()).To(gomega.BeTrue())
})
})