@@ -12,13 +12,19 @@ import (
12
12
"github.com/pborman/uuid"
13
13
14
14
"github.com/coreos/coreos-assembler/mantle/kola"
15
+ "github.com/coreos/coreos-assembler/mantle/kola/cluster"
15
16
"github.com/coreos/coreos-assembler/mantle/kola/register"
17
+ "github.com/coreos/coreos-assembler/mantle/platform"
18
+ "github.com/coreos/coreos-assembler/mantle/platform/machine/qemu"
16
19
"github.com/coreos/coreos-assembler/mantle/util"
17
20
)
18
21
19
22
const (
20
23
DockerTimeout = time .Second * 60
21
24
PortTimeout = time .Second * 3
25
+ uefi = "uefi"
26
+ uefiSecure = "uefi-secure"
27
+ bios = "bios"
22
28
)
23
29
24
30
// RHCOS services we expect disabled/inactive
@@ -37,22 +43,48 @@ var offServices = []string{
37
43
"tcsd.service" ,
38
44
}
39
45
46
+ var nativeFuncs = map [string ]register.NativeFuncWrap {
47
+ "PortSSH" : register .CreateNativeFuncWrap (TestPortSsh ),
48
+ "DbusPerms" : register .CreateNativeFuncWrap (TestDbusPerms ),
49
+ "ServicesActive" : register .CreateNativeFuncWrap (TestServicesActive ),
50
+ "ReadOnly" : register .CreateNativeFuncWrap (TestReadOnlyFs ),
51
+ "Useradd" : register .CreateNativeFuncWrap (TestUseradd ),
52
+ "MachineID" : register .CreateNativeFuncWrap (TestMachineID ),
53
+ "RHCOSGrowpart" : register .CreateNativeFuncWrap (TestRHCOSGrowfs , []string {"fcos" }... ),
54
+ "FCOSGrowpart" : register .CreateNativeFuncWrap (TestFCOSGrowfs , []string {"rhcos" }... ),
55
+ }
56
+
40
57
func init () {
41
58
register .RegisterTest (& register.Test {
42
59
Name : "basic" ,
43
60
Description : "Verify basic functionalities like SSH, systemd services, useradd, etc." ,
44
61
Run : LocalTests ,
45
62
ClusterSize : 1 ,
46
- NativeFuncs : map [string ]register.NativeFuncWrap {
47
- "PortSSH" : register .CreateNativeFuncWrap (TestPortSsh ),
48
- "DbusPerms" : register .CreateNativeFuncWrap (TestDbusPerms ),
49
- "ServicesActive" : register .CreateNativeFuncWrap (TestServicesActive ),
50
- "ReadOnly" : register .CreateNativeFuncWrap (TestReadOnlyFs ),
51
- "Useradd" : register .CreateNativeFuncWrap (TestUseradd ),
52
- "MachineID" : register .CreateNativeFuncWrap (TestMachineID ),
53
- "RHCOSGrowpart" : register .CreateNativeFuncWrap (TestRHCOSGrowfs , []string {"fcos" }... ),
54
- "FCOSGrowpart" : register .CreateNativeFuncWrap (TestFCOSGrowfs , []string {"rhcos" }... ),
55
- },
63
+ NativeFuncs : nativeFuncs ,
64
+ })
65
+ register .RegisterTest (& register.Test {
66
+ Name : "basic.uefi" ,
67
+ Description : "Verify basic functionalities like SSH, systemd services, useradd, etc, with UEFI enabled" ,
68
+ Run : uefiWithBasicTests ,
69
+ Platforms : []string {"qemu" },
70
+ ClusterSize : 0 ,
71
+ NativeFuncs : nativeFuncs ,
72
+ })
73
+ register .RegisterTest (& register.Test {
74
+ Name : "basic.uefi-secure" ,
75
+ Description : "Verify basic functionalities like SSH, systemd services, useradd, etc, with UEFI Secure Boot enabled" ,
76
+ Run : uefiSecureWithBasicTests ,
77
+ Platforms : []string {"qemu" },
78
+ ClusterSize : 0 ,
79
+ NativeFuncs : nativeFuncs ,
80
+ })
81
+ register .RegisterTest (& register.Test {
82
+ Name : "basic.nvme" ,
83
+ Description : "Verify basic functionalities like SSH, systemd services, useradd, etc, with nvme enabled" ,
84
+ Run : nvmeBasicTests ,
85
+ Platforms : []string {"qemu" },
86
+ ClusterSize : 0 ,
87
+ NativeFuncs : nativeFuncs ,
56
88
})
57
89
// TODO: Enable DockerPing/DockerEcho once fixed
58
90
// TODO: Only enable PodmanPing on non qemu. Needs:
@@ -92,6 +124,47 @@ func init() {
92
124
})
93
125
}
94
126
127
+ func uefiWithBasicTests (c cluster.TestCluster ) {
128
+ runBasicTests (c , uefi , false )
129
+ }
130
+
131
+ func uefiSecureWithBasicTests (c cluster.TestCluster ) {
132
+ runBasicTests (c , uefiSecure , false )
133
+ }
134
+
135
+ func nvmeBasicTests (c cluster.TestCluster ) {
136
+ runBasicTests (c , bios , true )
137
+ }
138
+
139
+ func runBasicTests (c cluster.TestCluster , firmware string , nvme bool ) {
140
+ var err error
141
+ var m platform.Machine
142
+
143
+ options := platform.QemuMachineOptions {
144
+ Firmware : firmware ,
145
+ Nvme : nvme ,
146
+ }
147
+ switch pc := c .Cluster .(type ) {
148
+ // These cases have to be separated because when put together to the same case statement
149
+ // the golang compiler no longer checks that the individual types in the case have the
150
+ // NewMachineWithQemuOptions function, but rather whether platform.Cluster
151
+ // does which fails
152
+ case * qemu.Cluster :
153
+ m , err = pc .NewMachineWithQemuOptions (nil , options )
154
+ default :
155
+ panic ("Unsupported cluster type" )
156
+ }
157
+ if err != nil {
158
+ c .Fatal (err )
159
+ }
160
+
161
+ // copy over kolet into the machine
162
+ if err := kola .ScpKolet ([]platform.Machine {m }); err != nil {
163
+ c .Fatal (err )
164
+ }
165
+ LocalTests (c )
166
+ }
167
+
95
168
func TestPortSsh () error {
96
169
//t.Parallel()
97
170
err := CheckPort ("tcp" , "127.0.0.1:22" , PortTimeout )
0 commit comments