Skip to content

Commit ac38a76

Browse files
kola: set SkipStartMachine and drop unused SSH keys for iso.* tests
The iso.* tests use systemd units that report success or failure via virtio channels and always power off the machine. Because of this, we do not need to SSH into the instance or check Ignition errors.
1 parent 89dc604 commit ac38a76

File tree

5 files changed

+14
-32
lines changed

5 files changed

+14
-32
lines changed

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

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -59,11 +59,6 @@ func isoTestAsDisk(c cluster.TestCluster, opts IsoTestOpts) {
5959
}
6060
config.AddSystemdUnit("live-signal-ok.service", liveSignalOKUnit, conf.Enable)
6161
config.AddSystemdUnit("verify-no-efi-boot-entry.service", verifyNoEFIBootEntry, conf.Enable)
62-
keys, err := qc.Keys()
63-
if err != nil {
64-
c.Fatal(err)
65-
}
66-
config.CopyKeys(keys)
6762

6863
overrideFW := func(builder *platform.QemuBuilder) error {
6964
switch {
@@ -91,8 +86,10 @@ func isoTestAsDisk(c cluster.TestCluster, opts IsoTestOpts) {
9186
return builder.AddIso(isopath, "", true)
9287
}
9388

89+
extra := platform.QemuMachineOptions{}
90+
extra.SkipStartMachine = true
9491
callbacks := qemu.BuilderCallbacks{SetupDisks: setupDisks, OverrideDefaults: overrideFW}
95-
_, err = qc.NewMachineWithQemuOptionsAndBuilderCallbacks(config, platform.QemuMachineOptions{}, callbacks)
92+
_, err = qc.NewMachineWithQemuOptionsAndBuilderCallbacks(config, extra, callbacks)
9693
if err != nil {
9794
c.Fatalf("Unable to create test machine: %v", err)
9895
}

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

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,6 @@ func testLiveFIPS(c cluster.TestCluster) {
5757
config.AddSystemdUnit("fips-verify.service", fipsVerify, conf.Enable)
5858
config.AddSystemdUnit("fips-signal-ok.service", liveSignalOKUnit, conf.Enable)
5959
config.AddSystemdUnit("fips-emergency-target.service", signalFailureUnit, conf.Enable)
60-
keys, err := qc.Keys()
61-
if err != nil {
62-
c.Fatal(err)
63-
}
64-
config.CopyKeys(keys)
6560

6661
overrideFW := func(builder *platform.QemuBuilder) error {
6762
builder.Firmware = "uefi"
@@ -88,8 +83,10 @@ func testLiveFIPS(c cluster.TestCluster) {
8883
return builder.AddIso(isopath, "", false)
8984
}
9085

86+
extra := platform.QemuMachineOptions{}
87+
extra.SkipStartMachine = true
9188
callbacks := qemu.BuilderCallbacks{SetupDisks: setupDisks, OverrideDefaults: overrideFW}
92-
_, err = qc.NewMachineWithQemuOptionsAndBuilderCallbacks(config, platform.QemuMachineOptions{}, callbacks)
89+
_, err = qc.NewMachineWithQemuOptionsAndBuilderCallbacks(config, extra, callbacks)
9390
if err != nil {
9491
c.Fatalf("Unable to create test machine: %v", err)
9592
}

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

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -113,11 +113,7 @@ func isoInstalliScsi(c cluster.TestCluster, opts IsoTestOpts) {
113113
if err != nil {
114114
c.Fatal(err)
115115
}
116-
keys, err := qc.Keys()
117-
if err != nil {
118-
c.Fatal(err)
119-
}
120-
config.CopyKeys(keys)
116+
121117
// Add a failure target to stop the test if something go wrong rather than waiting for the 10min timeout
122118
config.AddSystemdUnit("coreos-test-entered-emergency-target.service", signalFailureUnit, conf.Enable)
123119
config.MountHost("/var/cosaroot", true)
@@ -179,8 +175,10 @@ func isoInstalliScsi(c cluster.TestCluster, opts IsoTestOpts) {
179175
return nil
180176
}
181177

178+
extra := platform.QemuMachineOptions{}
179+
extra.SkipStartMachine = true
182180
callbacks := qemu.BuilderCallbacks{SetupDisks: setupDisks, OverrideDefaults: overrideFW}
183-
_, err = qc.NewMachineWithQemuOptionsAndBuilderCallbacks(config, platform.QemuMachineOptions{}, callbacks)
181+
_, err = qc.NewMachineWithQemuOptionsAndBuilderCallbacks(config, extra, callbacks)
184182
if err != nil {
185183
c.Fatalf("Unable to create test machine: %v", err)
186184
}

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

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -229,15 +229,11 @@ func isoRunTest(c cluster.TestCluster, opts IsoTestOpts, tempdir string) error {
229229
if opts.enableMultipath {
230230
qc.EnforceMultipath()
231231
}
232-
keys, err := qc.Keys()
233-
if err != nil {
234-
return err
235-
}
232+
236233
targetConfig, err := conf.EmptyIgnition().Render(conf.FailWarnings)
237234
if err != nil {
238235
return err
239236
}
240-
targetConfig.CopyKeys(keys)
241237
targetConfig.AddSystemdUnit("coreos-test-installer.service", signalCompletionUnit, conf.Enable)
242238
targetConfig.AddSystemdUnit("coreos-test-entered-emergency-target.service", signalFailureUnit, conf.Enable)
243239
targetConfig.AddSystemdUnit("coreos-test-installer-no-ignition.service", checkNoIgnition, conf.Enable)
@@ -359,7 +355,6 @@ func isoRunTest(c cluster.TestCluster, opts IsoTestOpts, tempdir string) error {
359355
if err != nil {
360356
return err
361357
}
362-
liveConfig.CopyKeys(keys)
363358
liveConfig.AddSystemdUnit("live-signal-ok.service", liveSignalOKUnit, conf.Enable)
364359
liveConfig.AddSystemdUnit("verify-no-efi-boot-entry.service", verifyNoEFIBootEntry, conf.Enable)
365360
liveConfig.AddSystemdUnit("iso-not-mounted-when-fromram.service", isoNotMountedUnit, conf.Enable)
@@ -446,8 +441,8 @@ func isoRunTest(c cluster.TestCluster, opts IsoTestOpts, tempdir string) error {
446441

447442
extra := platform.QemuMachineOptions{}
448443
extra.SkipStartMachine = true
449-
callacks := qemu.BuilderCallbacks{SetupDisks: setupDisks, SetupNetwork: setupNet, OverrideDefaults: overrideFW}
450-
qm, err := qc.NewMachineWithQemuOptionsAndBuilderCallbacks(liveConfig, extra, callacks)
444+
callbacks := qemu.BuilderCallbacks{SetupDisks: setupDisks, SetupNetwork: setupNet, OverrideDefaults: overrideFW}
445+
qm, err := qc.NewMachineWithQemuOptionsAndBuilderCallbacks(liveConfig, extra, callbacks)
451446
if err != nil {
452447
return errors.Wrap(err, "unable to create test machine")
453448
}

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

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -160,10 +160,7 @@ func testPXE(c cluster.TestCluster, opts IsoTestOpts) {
160160
AppendKargs: renderCosaTestIsoDebugKargs(),
161161
Insecure: opts.instInsecure,
162162
}
163-
keys, err := qc.Keys()
164-
if err != nil {
165-
c.Fatal(err)
166-
}
163+
167164
installerConfigData, err := yaml.Marshal(installerConfig)
168165
if err != nil {
169166
c.Fatal(err)
@@ -174,7 +171,6 @@ func testPXE(c cluster.TestCluster, opts IsoTestOpts) {
174171
if err != nil {
175172
c.Fatal(err)
176173
}
177-
liveConfig.CopyKeys(keys)
178174
liveConfig.AddSystemdUnit("live-signal-ok.service", liveSignalOKUnit, conf.Enable)
179175
liveConfig.AddSystemdUnit("coreos-test-entered-emergency-target.service", signalFailureUnit, conf.Enable)
180176
if opts.isOffline {
@@ -192,7 +188,6 @@ func testPXE(c cluster.TestCluster, opts IsoTestOpts) {
192188
if err != nil {
193189
c.Fatal(err)
194190
}
195-
targetConfig.CopyKeys(keys)
196191
targetConfig.AddSystemdUnit("coreos-test-installer.service", signalCompletionUnit, conf.Enable)
197192
targetConfig.AddSystemdUnit("coreos-test-entered-emergency-target.service", signalFailureUnit, conf.Enable)
198193
targetConfig.AddSystemdUnit("coreos-test-installer-no-ignition.service", checkNoIgnition, conf.Enable)

0 commit comments

Comments
 (0)