Skip to content

Commit f0629a4

Browse files
kola/tests/iso: add CheckLiveArtifactsExist helper function for ISO tests
Add helper function in common.go to validate presence of live artifacts.
1 parent 356e249 commit f0629a4

7 files changed

Lines changed: 24 additions & 3 deletions

File tree

mantle/kola/tests/iso/common.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,13 @@ func getIsoTestOpts(testName string) IsoTestOpts {
130130
return opts
131131
}
132132

133+
func CheckLiveArtifactsExist() error {
134+
if kola.CosaBuild.Meta.BuildArtifacts.LiveIso == nil || kola.CosaBuild.Meta.BuildArtifacts.LiveKernel == nil || kola.CosaBuild.Meta.BuildArtifacts.LiveInitramfs == nil || kola.CosaBuild.Meta.BuildArtifacts.LiveRootfs == nil {
135+
return fmt.Errorf("Build %s is missing live artifacts\n", kola.CosaBuild.Meta.Name)
136+
}
137+
return nil
138+
}
139+
133140
func IsDevBuild() bool {
134141
// Ignore signing verification by default when running with development build
135142
// https://github.com/coreos/fedora-coreos-tracker/issues/908

mantle/kola/tests/iso/live-as-disk.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,9 @@ func init() {
4444
}
4545

4646
func isoTestAsDisk(c cluster.TestCluster, opts IsoTestOpts) {
47+
if err := CheckLiveArtifactsExist(); err != nil {
48+
c.Fatal(err)
49+
}
4750
qc, ok := c.Cluster.(*qemu.Cluster)
4851
if !ok {
4952
c.Fatalf("Unsupported cluster type")

mantle/kola/tests/iso/live-fips.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,9 @@ ExecStart=grep FIPS etc/crypto-policies/config
5151
RequiredBy=fips-signal-ok.service`
5252

5353
func testLiveFIPS(c cluster.TestCluster, opts IsoTestOpts) {
54+
if err := CheckLiveArtifactsExist(); err != nil {
55+
c.Fatal(err)
56+
}
5457
qc, ok := c.Cluster.(*qemu.Cluster)
5558
if !ok {
5659
c.Fatalf("Unsupported cluster type")

mantle/kola/tests/iso/live-iscsi.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,9 @@ var iscsi_butane_config string
106106
// - when the system is booted, write a success string to /dev/virtio-ports/testisocompletion
107107
// - as this serial device is mapped to the host serial device, the test concludes
108108
func isoInstalliScsi(c cluster.TestCluster, opts IsoTestOpts) {
109+
if err := CheckLiveArtifactsExist(); err != nil {
110+
c.Fatal(err)
111+
}
109112
qc, ok := c.Cluster.(*qemu.Cluster)
110113
if !ok {
111114
c.Fatalf("Unsupported cluster type")

mantle/kola/tests/iso/live-iso.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,9 @@ func init() {
100100
}
101101

102102
func runLiveIsoInstallTest(c cluster.TestCluster, opts IsoTestOpts) {
103+
if err := CheckLiveArtifactsExist(); err != nil {
104+
c.Fatal(err)
105+
}
103106
if opts.isMiniso && opts.isOffline { // ideally this'd be one enum parameter
104107
c.Fatal("Can't run minimal install offline")
105108
}

mantle/kola/tests/iso/live-login.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,9 @@ func init() {
7171
}
7272

7373
func testLiveLogin(c cluster.TestCluster, firmware string) {
74-
if kola.CosaBuild.Meta.BuildArtifacts.LiveIso == nil || kola.CosaBuild.Meta.BuildArtifacts.LiveKernel == nil {
75-
c.Fatalf("Build %s is missing live artifacts\n", kola.CosaBuild.Meta.Name)
74+
if err := CheckLiveArtifactsExist(); err != nil {
75+
c.Fatal(err)
7676
}
77-
7877
butane := conf.Butane(`
7978
variant: fcos
8079
version: 1.1.0`)

mantle/kola/tests/iso/live-pxe.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,9 @@ RequiredBy=coreos-installer.target
9494
`
9595

9696
func testPXE(c cluster.TestCluster, opts IsoTestOpts) {
97+
if err := CheckLiveArtifactsExist(); err != nil {
98+
c.Fatal(err)
99+
}
97100
qc, ok := c.Cluster.(*qemu.Cluster)
98101
if !ok {
99102
c.Fatalf("Unsupported cluster type")

0 commit comments

Comments
 (0)