Skip to content

Commit 06da492

Browse files
committed
kola/testiso: test volume ID has OS name prefix
Verify that the volume ID of the live ISO has the expected prefix. This doesn't really need to be tested on a live boot. E.g. `isoinfo` on the live ISO artifact can verify this. But putting it in testiso is just easier.
1 parent 74bda44 commit 06da492

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

mantle/cmd/kola/testiso.go

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,21 @@ RequiredBy=coreos-installer.target
264264
# for iso-as-disk
265265
RequiredBy=multi-user.target`
266266

267+
// Verify that the volume ID is the OS name. See also
268+
// https://github.com/openshift/assisted-image-service/pull/477.
269+
// This is the same as the LABEL of the block device for ISO9660. See
270+
// https://github.com/util-linux/util-linux/blob/643bdae8e38055e36acf2963c3416de206081507/libblkid/src/superblocks/iso9660.c#L366-L377
271+
var verifyIsoVolumeId = `[Unit]
272+
Description=Verify ISO Volume ID
273+
OnFailure=emergency.target
274+
OnFailureJobMode=isolate
275+
[Service]
276+
Type=oneshot
277+
RemainAfterExit=yes
278+
ExecStart=bash -c "[[ $(lsblk -no LABEL /dev/sr0) == %s-* ]]"
279+
[Install]
280+
RequiredBy=coreos-installer.target`
281+
267282
// Unit to check that /run/media/iso is not mounted when
268283
// coreos.liveiso.fromram kernel argument is passed
269284
var isoNotMountedUnit = `[Unit]
@@ -886,6 +901,8 @@ func testLiveIso(ctx context.Context, inst platform.Install, outdir string, mini
886901
liveConfig.AddSystemdUnit("verify-no-efi-boot-entry.service", verifyNoEFIBootEntry, conf.Enable)
887902
liveConfig.AddSystemdUnit("iso-not-mounted-when-fromram.service", isoNotMountedUnit, conf.Enable)
888903
liveConfig.AddSystemdUnit("coreos-test-entered-emergency-target.service", signalFailureUnit, conf.Enable)
904+
volumeIdUnitContents := fmt.Sprintf(verifyIsoVolumeId, kola.CosaBuild.Meta.Name)
905+
liveConfig.AddSystemdUnit("verify-iso-volume-id.service", volumeIdUnitContents, conf.Enable)
889906

890907
targetConfig := *virtioJournalConfig
891908
targetConfig.AddSystemdUnit("coreos-test-installer.service", signalCompletionUnit, conf.Enable)

0 commit comments

Comments
 (0)