-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvm_test.go
74 lines (64 loc) · 1.79 KB
/
vm_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
62
63
64
65
66
67
68
69
70
71
72
73
74
package virt
import (
"testing"
"github.com/stretchr/testify/assert"
)
func getTests() map[string]bool {
return map[string]bool{
"testdata/baremetal": false,
"testdata/docker": false,
"testdata/kvm": false,
"testdata/linux-vserver": false,
"testdata/lx86": false,
"testdata/lxc": false,
"testdata/openvz": false,
"testdata/podman": false,
"testdata/qemu": false,
"testdata/rhel5-xen-dom0": false,
"testdata/rhel5-xen-domU-hvm-ia64": false,
"testdata/rhel5-xen-domU-pv": false,
"testdata/uml": false,
"testdata/wsl": false,
"testdata/zvm": false,
}
}
func run(t *testing.T, tests map[string]bool, f func(root string) bool) {
for testdata, expected := range tests {
t.Run(testdata, func(t *testing.T) {
assert.Equal(t, expected, f(testdata))
})
}
}
func TestLinuxVServer(t *testing.T) {
tests := getTests()
tests["testdata/linux-vserver"] = true
run(t, tests, linuxVServer)
}
func TestUML(t *testing.T) {
tests := getTests()
tests["testdata/uml"] = true
run(t, tests, uml)
}
func TestPowerVMLx86(t *testing.T) {
tests := getTests()
tests["testdata/lx86"] = true
run(t, tests, powerVMLx86)
}
func TestZVM(t *testing.T) {
tests := getTests()
tests["testdata/zvm"] = true
run(t, tests, zvm)
}
func TestXen(t *testing.T) {
tests := getTests()
tests["testdata/rhel5-xen-dom0"] = true
tests["testdata/rhel5-xen-domU-hvm-ia64"] = true
tests["testdata/rhel5-xen-domU-pv"] = true
run(t, tests, xen)
}
func TestQEMUKVM(t *testing.T) {
tests := getTests()
tests["testdata/kvm"] = true
tests["testdata/qemu"] = true
run(t, tests, qemuKVM)
}