Repository: osbuild/osbuild-composer
Pull request #2294 (2022-02-11 14:59:57)

tests/libvirt: add some regression tests
This is just a simple check to verify rhbz#2004401 and rhbz#2003038


This pull request includes:

- [ ] adequate testing for the new functionality or fixed issue
- [ ] adequate documentation informing people about the change such as
  - [ ] submit a PR for the [guides](https://github.com/osbuild/guides) repository if this PR changed any behavior described there: https://www.osbuild.org/guides/

<!--
Thanks for proposing a change to osbuild-composer!

Please don't remove the above check list. These are things that each pull
request must have before it is merged. It helps maintainers to not forget
anything.

If the reason for ticking any of the boxes is ambiguous, please add a short
note explaining why.

In addition, if this pull request fixes a downstream issue, please refer to
test/README.md and add these additional items:

- [ ] 1st commit of any `rhbz#` related PR contains bug reproducer; CI reports FAIL or
- [ ] PR contains automated tests for new functionality and
- [ ] QE has approved reproducer/new tests and
- [ ] Subsequent commits provide bug fixes without modifying the reproducer; CI reports PASS and
- [ ] QE approves this PR; RHBZ status is set to `MODIFIED + Verified=Tested`
-->



Patch:
diff --git a/internal/distro/rhel86/stage_options.go b/internal/distro/rhel86/stage_options.go
index 48f55f9f2..cb6a2bd6e 100644
--- a/internal/distro/rhel86/stage_options.go
+++ b/internal/distro/rhel86/stage_options.go
@@ -359,6 +359,7 @@ func xorrisofsStageOptions(filename, isolabel, arch string, isolinux bool) *osbu
 		VolID:    fmt.Sprintf(isolabel, arch),
 		SysID:    "LINUX",
 		EFI:      "images/efiboot.img",
+		ISOLevel: 3,
 	}
 
 	if isolinux {
diff --git a/internal/distro/rhel90/stage_options.go b/internal/distro/rhel90/stage_options.go
index 47adffde4..e2d9ae932 100644
--- a/internal/distro/rhel90/stage_options.go
+++ b/internal/distro/rhel90/stage_options.go
@@ -359,6 +359,7 @@ func xorrisofsStageOptions(filename, isolabel, arch string, isolinux bool) *osbu
 		VolID:    fmt.Sprintf(isolabel, arch),
 		SysID:    "LINUX",
 		EFI:      "images/efiboot.img",
+		ISOLevel: 3,
 	}
 
 	if isolinux {


Test patch:
diff --git a/test/cases/regression-bigiso.sh b/test/cases/regression-bigiso.sh
new file mode 100644
index 000000000..d995220e3
--- /dev/null
+++ b/test/cases/regression-bigiso.sh
@@ -0,0 +1,100 @@
+#!/bin/bash
+# https://bugzilla.redhat.com/show_bug.cgi?id=2056451
+
+# Get OS data.
+source /usr/libexec/osbuild-composer-test/set-env-variables.sh
+
+# Provision the software under test.
+/usr/libexec/osbuild-composer-test/provision.sh
+
+case "${ID}-${VERSION_ID}" in
+    "rhel-8.6" | "rhel-9.0" | "centos-9")
+        ;;
+    *)
+        echo "$0 is not enabled for ${ID}-${VERSION_ID} skipping..."
+        exit 0
+        ;;
+esac
+
+if [ "$ARCH" != "x86_64" ]; then
+  echo "Workstation group is only available on x86_64"
+  exit 0
+fi
+
+
+set -xeuo pipefail
+
+function get_build_info() {
+    key="$1"
+    fname="$2"
+    if rpm -q --quiet weldr-client; then
+        key=".body${key}"
+    fi
+    jq -r "${key}" "${fname}"
+}
+
+# Provision the software under test.
+BLUEPRINT_FILE=/tmp/blueprint.toml
+COMPOSE_START=/tmp/compose-start.json
+COMPOSE_INFO=/tmp/compose-info.json
+
+# Write a basic blueprint for our image.
+tee "$BLUEPRINT_FILE" > /dev/null << 'EOF'
+name = "toobig"
+description = "too big blueprint"
+version = "0.0.1"
+modules = []
+#groups = []
+
+[[customizations.user]]
+# password for admin is rootroot
+name = "admin"
+description = "admin"
+password = "$6$ismFu3TUg0KR8.kJ$rddx3JVWXVaPF06XHeS1QNV6D6U3vo8WN4mi/V2mKLZ9ZKsMUlIwLhU.WvxfT.5F1PqUrx8Y8DUr/a5iTJQlw."
+home = "/home/admin/"
+shell = "/usr/bin/bash"
+groups = ["users", "wheel"]
+
+[[groups]]
+name="Workstation"
+
+[[packages]]
+name="httpd"
+version="*"
+
+[[packages]]
+name="gnome-session"
+version="*"
+
+[customizations]
+hostname = "custombase"
+EOF
+
+sudo composer-cli blueprints push "$BLUEPRINT_FILE"
+sudo composer-cli blueprints depsolve toobig
+sudo composer-cli --json compose start toobig image-installer | tee "${COMPOSE_START}"
+COMPOSE_ID=$(get_build_info ".build_id" "$COMPOSE_START")
+# Wait for the compose to finish.
+echo "⏱ Waiting for compose to finish: ${COMPOSE_ID}"
+while true; do
+    sudo composer-cli --json compose info "${COMPOSE_ID}" | tee "$COMPOSE_INFO" > /dev/null
+    COMPOSE_STATUS=$(get_build_info ".queue_status" "$COMPOSE_INFO")
+
+    # Is the compose finished?
+    if [[ $COMPOSE_STATUS != RUNNING ]] && [[ $COMPOSE_STATUS != WAITING ]]; then
+        break
+    fi
+
+    # Wait 30 seconds and try again.
+    sleep 30
+done
+
+sudo composer-cli compose delete "${COMPOSE_ID}" >/dev/null
+
+jq . "${COMPOSE_INFO}"
+
+# Did the compose finish with success?
+if [[ $COMPOSE_STATUS != FINISHED ]]; then
+    echo "Something went wrong with the compose. 😢"
+    exit 1
+fi
diff --git a/test/cases/regression.sh b/test/cases/regression.sh
index 6ccc6af43..221f917ba 100644
--- a/test/cases/regression.sh
+++ b/test/cases/regression.sh
@@ -15,6 +15,7 @@ TEST_CASES=(
     "regression-include-excluded-packages.sh"
     "regression-composer-works-behind-satellite.sh"
     "regression-composer-works-behind-satellite-fallback.sh"
+    "regression-bigiso.sh"
 )
 
 # Print out a nice test divider so we know when tests stop and start.
diff --git a/test/data/manifests/centos_8-aarch64-image_installer-boot.json b/test/data/manifests/centos_8-aarch64-image_installer-boot.json
index ad15aea58..d85d00c86 100644
--- a/test/data/manifests/centos_8-aarch64-image_installer-boot.json
+++ b/test/data/manifests/centos_8-aarch64-image_installer-boot.json
@@ -2062,7 +2062,8 @@
               "filename": "installer.iso",
               "volid": "CentOS-Stream-8-aarch64-dvd",
               "sysid": "LINUX",
-              "efi": "images/efiboot.img"
+              "efi": "images/efiboot.img",
+              "isolevel": 3
             }
           },
           {
@@ -21914,4 +21915,4 @@
       }
     ]
   }
-}
+}
\ No newline at end of file
diff --git a/test/data/manifests/centos_8-x86_64-image_installer-boot.json b/test/data/manifests/centos_8-x86_64-image_installer-boot.json
index 3c0aa5c89..1069dd97f 100644
--- a/test/data/manifests/centos_8-x86_64-image_installer-boot.json
+++ b/test/data/manifests/centos_8-x86_64-image_installer-boot.json
@@ -2096,7 +2096,8 @@
                 "catalog": "isolinux/boot.cat"
               },
               "efi": "images/efiboot.img",
-              "isohybridmbr": "/usr/share/syslinux/isohdpfx.bin"
+              "isohybridmbr": "/usr/share/syslinux/isohdpfx.bin",
+              "isolevel": 3
             }
           },
           {
diff --git a/test/data/manifests/centos_9-aarch64-image_installer-boot.json b/test/data/manifests/centos_9-aarch64-image_installer-boot.json
index 72ee0b504..8d4034aba 100644
--- a/test/data/manifests/centos_9-aarch64-image_installer-boot.json
+++ b/test/data/manifests/centos_9-aarch64-image_installer-boot.json
@@ -2018,7 +2018,8 @@
               "filename": "installer.iso",
               "volid": "CentOS-Stream-9-BaseOS-aarch64",
               "sysid": "LINUX",
-              "efi": "images/efiboot.img"
+              "efi": "images/efiboot.img",
+              "isolevel": 3
             }
           },
           {
@@ -21514,4 +21515,4 @@
       }
     ]
   }
-}
+}
\ No newline at end of file
diff --git a/test/data/manifests/centos_9-x86_64-image_installer-boot.json b/test/data/manifests/centos_9-x86_64-image_installer-boot.json
index 56767600e..9c5af02b1 100644
--- a/test/data/manifests/centos_9-x86_64-image_installer-boot.json
+++ b/test/data/manifests/centos_9-x86_64-image_installer-boot.json
@@ -2060,7 +2060,8 @@
                 "catalog": "isolinux/boot.cat"
               },
               "efi": "images/efiboot.img",
-              "isohybridmbr": "/usr/share/syslinux/isohdpfx.bin"
+              "isohybridmbr": "/usr/share/syslinux/isohdpfx.bin",
+              "isolevel": 3
             }
           },
           {
diff --git a/test/data/manifests/rhel_86-aarch64-image_installer-boot.json b/test/data/manifests/rhel_86-aarch64-image_installer-boot.json
index 642402f00..addd141a3 100644
--- a/test/data/manifests/rhel_86-aarch64-image_installer-boot.json
+++ b/test/data/manifests/rhel_86-aarch64-image_installer-boot.json
@@ -2093,7 +2093,8 @@
               "filename": "installer.iso",
               "volid": "RHEL-8-6-0-BaseOS-aarch64",
               "sysid": "LINUX",
-              "efi": "images/efiboot.img"
+              "efi": "images/efiboot.img",
+              "isolevel": 3
             }
           },
           {
@@ -20563,4 +20564,4 @@
       }
     ]
   }
-}
+}
\ No newline at end of file
diff --git a/test/data/manifests/rhel_86-x86_64-image_installer-boot.json b/test/data/manifests/rhel_86-x86_64-image_installer-boot.json
index a027b821e..38b4750ca 100644
--- a/test/data/manifests/rhel_86-x86_64-image_installer-boot.json
+++ b/test/data/manifests/rhel_86-x86_64-image_installer-boot.json
@@ -2132,7 +2132,8 @@
                 "catalog": "isolinux/boot.cat"
               },
               "efi": "images/efiboot.img",
-              "isohybridmbr": "/usr/share/syslinux/isohdpfx.bin"
+              "isohybridmbr": "/usr/share/syslinux/isohdpfx.bin",
+              "isolevel": 3
             }
           },
           {
diff --git a/test/data/manifests/rhel_90-aarch64-image_installer-boot.json b/test/data/manifests/rhel_90-aarch64-image_installer-boot.json
index 9f32649ea..fc163f7c8 100644
--- a/test/data/manifests/rhel_90-aarch64-image_installer-boot.json
+++ b/test/data/manifests/rhel_90-aarch64-image_installer-boot.json
@@ -2041,7 +2041,8 @@
               "filename": "installer.iso",
               "volid": "RHEL-9-0-0-BaseOS-aarch64",
               "sysid": "LINUX",
-              "efi": "images/efiboot.img"
+              "efi": "images/efiboot.img",
+              "isolevel": 3
             }
           },
           {
@@ -20127,4 +20128,4 @@
       }
     ]
   }
-}
+}
\ No newline at end of file
diff --git a/test/data/manifests/rhel_90-x86_64-image_installer-boot.json b/test/data/manifests/rhel_90-x86_64-image_installer-boot.json
index deb5d73fd..638476610 100644
--- a/test/data/manifests/rhel_90-x86_64-image_installer-boot.json
+++ b/test/data/manifests/rhel_90-x86_64-image_installer-boot.json
@@ -2077,7 +2077,8 @@
                 "catalog": "isolinux/boot.cat"
               },
               "efi": "images/efiboot.img",
-              "isohybridmbr": "/usr/share/syslinux/isohdpfx.bin"
+              "isohybridmbr": "/usr/share/syslinux/isohdpfx.bin",
+              "isolevel": 3
             }
           },
           {
diff --git a/tools/libvirt_test.sh b/tools/libvirt_test.sh
index b71ae0bb6..0d136f6e4 100755
--- a/tools/libvirt_test.sh
+++ b/tools/libvirt_test.sh
@@ -300,6 +300,13 @@ for LOOP_COUNTER in $(seq 0 ${MAX_LOOPS}); do
     echo "Machine is not ready yet, retrying connection."
     sleep 10
 done
+# additional tests for regressions
+SSH_OPTIONS=(-o StrictHostKeyChecking=no -o ConnectTimeout=5)
+# simple check if manual pages are installed, rhbz#2004401
+sudo ssh "${SSH_OPTIONS[@]}" -i "${SSH_KEY}" redhat@"$INSTANCE_ADDRESS" 'man man > /dev/null'
+# check for grubenv presence and if  grubby command exits with 0, rhbz#2003038
+sudo ssh "${SSH_OPTIONS[@]}" -i "${SSH_KEY}" redhat@"$INSTANCE_ADDRESS" 'sudo ls /boot/grub2/grubenv > /dev/null'
+sudo ssh "${SSH_OPTIONS[@]}" -i "${SSH_KEY}" redhat@"$INSTANCE_ADDRESS" 'sudo grubby --set-default-index=0 > /dev/null'
 
 # Clean up our mess.
 greenprint "🧼 Cleaning up"