@@ -12,13 +12,19 @@ import (
1212 "github.com/pborman/uuid"
1313
1414 "github.com/coreos/coreos-assembler/mantle/kola"
15+ "github.com/coreos/coreos-assembler/mantle/kola/cluster"
1516 "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"
1619 "github.com/coreos/coreos-assembler/mantle/util"
1720)
1821
1922const (
2023 DockerTimeout = time .Second * 60
2124 PortTimeout = time .Second * 3
25+ uefi = "uefi"
26+ uefiSecure = "uefi-secure"
27+ bios = "bios"
2228)
2329
2430// RHCOS services we expect disabled/inactive
@@ -37,22 +43,48 @@ var offServices = []string{
3743 "tcsd.service" ,
3844}
3945
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+
4057func init () {
4158 register .RegisterTest (& register.Test {
4259 Name : "basic" ,
4360 Description : "Verify basic functionalities like SSH, systemd services, useradd, etc." ,
4461 Run : LocalTests ,
4562 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 ,
5688 })
5789 // TODO: Enable DockerPing/DockerEcho once fixed
5890 // TODO: Only enable PodmanPing on non qemu. Needs:
@@ -92,6 +124,47 @@ func init() {
92124 })
93125}
94126
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+
95168func TestPortSsh () error {
96169 //t.Parallel()
97170 err := CheckPort ("tcp" , "127.0.0.1:22" , PortTimeout )
0 commit comments