Test: rework integration test to run on all supported distros

Previously, the integration test was always skipped in c9s. Rework it to
pick the correct image manifest based on the running distro and build it
using osbuild.

Pick manifests for the latest distro versions from the upstream
osbuild-composer repository. Use qcow2 image with customizations.

Related: rhbz#2132250

Signed-off-by: Tomáš Hozza <thozza@redhat.com>
This commit is contained in:
Tomáš Hozza 2023-02-15 10:07:58 +01:00
parent 7f7c2d2f19
commit 01e2f67db0
No known key found for this signature in database
GPG Key ID: C5887AD51D9F3C2D
10 changed files with 32185 additions and 3561 deletions

View File

@ -0,0 +1,9 @@
summary: Build simple image using osbuild
prepare:
how: install
package:
- osbuild
execute:
script: ./tests/scripts/build-images.sh ./tests/manifests
duration: 4h

View File

@ -1,4 +1,4 @@
summary: Run osbuild tests
summary: Run osbuild unit tests from source
prepare:
how: install
package:
@ -12,6 +12,3 @@ discover:
dist-git-source: true
execute:
how: tmt
adjust:
enabled: false
when: distro == centos-stream-9

View File

@ -1,2 +0,0 @@
summary: Run image test
test: osbuild test-image.json --output-directory=/var/tmp/osbuild

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

7021
tests/manifests/fedora.json Normal file

File diff suppressed because it is too large Load Diff

4083
tests/manifests/rhel-8.json Normal file

File diff suppressed because it is too large Load Diff

7021
tests/manifests/rhel-9.json Normal file

File diff suppressed because it is too large Load Diff

49
tests/scripts/build-images.sh Executable file
View File

@ -0,0 +1,49 @@
#!/usr/bin/bash
set -euxo pipefail
MANIFESTS_DIR=$1
# check that MANIFESTS_DIR is a directory
if [ ! -d "$MANIFESTS_DIR" ]; then
echo "Error: $MANIFESTS_DIR is not a directory"
exit 1
fi
# ensure that we are running on x86_64 architecture
if [ "$(uname -m)" != "x86_64" ]; then
echo "Error: this script is only supported on x86_64 architecture"
exit 1
fi
. /etc/os-release
case "${ID}-${VERSION_ID}" in
"fedora-*")
IMAGE_MANIFEST="${MANIFESTS_DIR}/fedora.json"
;;
"rhel-8.*")
IMAGE_MANIFEST="${MANIFESTS_DIR}/rhel-8.json"
;;
"rhel-9.*")
IMAGE_MANIFEST="${MANIFESTS_DIR}/rhel-9.json"
;;
"centos-8")
IMAGE_MANIFEST="${MANIFESTS_DIR}/centos-8.json"
;;
"centos-9")
IMAGE_MANIFEST="${MANIFESTS_DIR}/centos-9.json"
;;
*)
echo "Error: unsupported OS: ${ID}-${VERSION_ID}"
exit 1
;;
esac
OUTPUT_DIR=/var/tmp/osbuild-output
STORE_DIR=/var/tmp/osbuild-store
sudo mkdir -p "${OUTPUT_DIR}"
sudo mkdir -p "${STORE_DIR}"
# all the images are built with qcow2 format, so export it
EXPORT_PIPELINE="qcow2"
sudo osbuild --output-directory "${OUTPUT_DIR}" --store "${STORE_DIR}" --export "${EXPORT_PIPELINE}" "${IMAGE_MANIFEST}"

File diff suppressed because it is too large Load Diff