[test] Adapt TestExtensions for OKD
On OKD, installation of grouped extensions is not suported yet.
This adapts the test to only check for the extension packages
actually expected on OKD or OCP.
@@ -275,8 +275,19 @@ func TestExtensions(t *testing.T) {
assert.Equal(t, infraNode.Annotations[constants.CurrentMachineConfigAnnotationKey], renderedConfig)
assert.Equal(t, infraNode.Annotations[constants.MachineConfigDaemonStateAnnotationKey], constants.MachineConfigDaemonStateDone)
- installedPackages := execCmdOnNode(t, cs, infraNode, "chroot", "/rootfs", "rpm", "-q", "usbguard", "kernel-devel", "kernel-headers")
- expectedPackages := []string{"usbguard", "kernel-devel", "kernel-headers"}
+ isOKD, err := isOKDCluster(cs)
+ require.Nil(t, err)
+
+ var installedPackages string
+ var expectedPackages []string
+ if isOKD {
+ // OKD does not support grouped extensions yet, so installing kernel-devel will not also pull in kernel-headers
+ installedPackages = execCmdOnNode(t, cs, infraNode, "chroot", "/rootfs", "rpm", "-q", "usbguard", "kernel-devel")
+ expectedPackages = []string{"usbguard", "kernel-devel"}
+ } else {
+ installedPackages = execCmdOnNode(t, cs, infraNode, "chroot", "/rootfs", "rpm", "-q", "usbguard", "kernel-devel", "kernel-headers")
+ expectedPackages = []string{"usbguard", "kernel-devel", "kernel-headers"}
+ }
for _, v := range expectedPackages {
if !strings.Contains(installedPackages, v) {
t.Fatalf("Node %s doesn't have expected extensions", infraNode.Name)
@@ -303,8 +314,12 @@ func TestExtensions(t *testing.T) {
assert.Equal(t, infraNode.Annotations[constants.CurrentMachineConfigAnnotationKey], oldInfraRenderedConfig)
assert.Equal(t, infraNode.Annotations[constants.MachineConfigDaemonStateAnnotationKey], constants.MachineConfigDaemonStateDone)
+ if isOKD {
+ // OKD does not support grouped extensions yet, so installing kernel-devel will not also pull in kernel-headers
+ installedPackages = execCmdOnNode(t, cs, infraNode, "chroot", "/rootfs", "rpm", "-qa", "usbguard", "kernel-devel")
+ } else {
installedPackages = execCmdOnNode(t, cs, infraNode, "chroot", "/rootfs", "rpm", "-qa", "usbguard", "kernel-devel", "kernel-headers")
- expectedPackages = []string{"usbguard", "kernel-devel", "kernel-headers"}
+ }
for _, v := range expectedPackages {
if strings.Contains(installedPackages, v) {
t.Fatalf("Node %s did not rollback successfully", infraNode.Name)
