Enable gating for RHEL-10
Resolves: RHELMISC-3930
This commit is contained in:
parent
3e2889caec
commit
55460c84da
1
.fmf/version
Normal file
1
.fmf/version
Normal file
@ -0,0 +1 @@
|
|||||||
|
1
|
12
gating.yaml
12
gating.yaml
@ -1,12 +1,6 @@
|
|||||||
--- !Policy
|
--- !Policy
|
||||||
product_versions:
|
product_versions:
|
||||||
- fedora-*
|
- rhel-10
|
||||||
decision_context: bodhi_update_push_testing
|
decision_context: osci_compose_gate
|
||||||
rules:
|
rules:
|
||||||
- !PassingTestCaseRule {test_case_name: fedora-ci.koji-build.tier0.functional}
|
- !PassingTestCaseRule {test_case_name: osci.brew-build.tier0.functional}
|
||||||
--- !Policy
|
|
||||||
product_versions:
|
|
||||||
- fedora-*
|
|
||||||
decision_context: bodhi_update_push_stable
|
|
||||||
rules:
|
|
||||||
- !PassingTestCaseRule {test_case_name: fedora-ci.koji-build.tier0.functional}
|
|
||||||
|
10
plans/integration-tests.fmf
Normal file
10
plans/integration-tests.fmf
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
summary: Run osbuild integration tests
|
||||||
|
prepare:
|
||||||
|
how: install
|
||||||
|
package:
|
||||||
|
- osbuild
|
||||||
|
discover:
|
||||||
|
how: fmf
|
||||||
|
filter: tag:integration-test
|
||||||
|
execute:
|
||||||
|
how: tmt
|
12
plans/unit-tests.fmf
Normal file
12
plans/unit-tests.fmf
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
summary: Run osbuild unit tests from dist-git sources
|
||||||
|
prepare:
|
||||||
|
how: install
|
||||||
|
package:
|
||||||
|
- git
|
||||||
|
- make
|
||||||
|
- osbuild
|
||||||
|
discover:
|
||||||
|
how: fmf
|
||||||
|
filter: tag:unit-test
|
||||||
|
execute:
|
||||||
|
how: tmt
|
52
tests/image-build/build-images.sh
Executable file
52
tests/image-build/build-images.sh
Executable file
@ -0,0 +1,52 @@
|
|||||||
|
#!/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"
|
||||||
|
;;
|
||||||
|
centos-10)
|
||||||
|
IMAGE_MANIFEST="${MANIFESTS_DIR}/centos-10.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}"
|
4
tests/image-build/main.fmf
Normal file
4
tests/image-build/main.fmf
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
summary: Build simple image using osbuild
|
||||||
|
tag: integration-test
|
||||||
|
duration: 1h
|
||||||
|
test: ./build-images.sh ./manifests
|
3518
tests/image-build/manifests/centos-10.json
Normal file
3518
tests/image-build/manifests/centos-10.json
Normal file
File diff suppressed because it is too large
Load Diff
7202
tests/image-build/manifests/centos-8.json
Normal file
7202
tests/image-build/manifests/centos-8.json
Normal file
File diff suppressed because it is too large
Load Diff
6799
tests/image-build/manifests/centos-9.json
Normal file
6799
tests/image-build/manifests/centos-9.json
Normal file
File diff suppressed because it is too large
Load Diff
7021
tests/image-build/manifests/fedora.json
Normal file
7021
tests/image-build/manifests/fedora.json
Normal file
File diff suppressed because it is too large
Load Diff
4083
tests/image-build/manifests/rhel-8.json
Normal file
4083
tests/image-build/manifests/rhel-8.json
Normal file
File diff suppressed because it is too large
Load Diff
7021
tests/image-build/manifests/rhel-9.json
Normal file
7021
tests/image-build/manifests/rhel-9.json
Normal file
File diff suppressed because it is too large
Load Diff
4
tests/unit-tests/main.fmf
Normal file
4
tests/unit-tests/main.fmf
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
summary: Run osbuild unit tests from dist-git sources
|
||||||
|
tag: unit-test
|
||||||
|
duration: 4h
|
||||||
|
test: ./prep-host-environment.sh; sudo chcon $(matchpathcon -n /usr/bin/osbuild) ./run-unit-tests.sh; ./run-unit-tests.sh
|
69
tests/unit-tests/prep-host-environment.sh
Executable file
69
tests/unit-tests/prep-host-environment.sh
Executable file
@ -0,0 +1,69 @@
|
|||||||
|
#!/usr/bin/bash
|
||||||
|
# Prepare the host environment for running the osbuild unit tests.
|
||||||
|
# This includes installing missing dependencies and tools.
|
||||||
|
|
||||||
|
set -euxo pipefail
|
||||||
|
|
||||||
|
source /etc/os-release
|
||||||
|
|
||||||
|
case "${ID}" in
|
||||||
|
fedora)
|
||||||
|
PKG_MAINT_TOOL="fedpkg"
|
||||||
|
sudo dnf install -y "${PKG_MAINT_TOOL}"
|
||||||
|
;;
|
||||||
|
rhel)
|
||||||
|
PKG_MAINT_TOOL="rhpkg"
|
||||||
|
# rhpkg is not available in the default repos
|
||||||
|
sudo curl -L -o "/etc/yum.repos.d/rcm-tools-rhel-${VERSION_ID%.*}-baseos.repo" "http://download.devel.redhat.com/rel-eng/internal/rcm-tools-rhel-${VERSION_ID%.*}-baseos.repo"
|
||||||
|
# install the RH IT CA certificate used by the repo above
|
||||||
|
sudo curl -L -o /etc/pki/ca-trust/source/anchors/2015-IT-Root-CA.pem http://certs.corp.redhat.com/certs/2015-IT-Root-CA.pem
|
||||||
|
sudo curl -L -o /etc/pki/ca-trust/source/anchors/2022-IT-Root-CA.pem http://certs.corp.redhat.com/certs/2022-IT-Root-CA.pem
|
||||||
|
sudo update-ca-trust
|
||||||
|
;;
|
||||||
|
centos)
|
||||||
|
PKG_MAINT_TOOL="centpkg"
|
||||||
|
# centpkg is not available in the default repos
|
||||||
|
sudo dnf install -y epel-release
|
||||||
|
# CRB repos are available only for CentOS Stream 9
|
||||||
|
if [ "${VERSION_ID}" == "9" ]; then
|
||||||
|
dnf config-manager --set-enabled crb
|
||||||
|
fi
|
||||||
|
|
||||||
|
# CRB repos are available for CentOS Stream 10
|
||||||
|
if [ "${VERSION_ID}" == "10" ]; then
|
||||||
|
dnf config-manager --set-enabled crb
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "Error: unsupported OS: ${ID}-${VERSION_ID}"
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
# Move to the checked out git repo with the test plans
|
||||||
|
# this should be the root of the dist-git repo
|
||||||
|
cd "${TMT_TREE}"
|
||||||
|
|
||||||
|
# install all test dependencies
|
||||||
|
sudo dnf install -y \
|
||||||
|
"${PKG_MAINT_TOOL}" \
|
||||||
|
rpmdevtools \
|
||||||
|
python3-mako \
|
||||||
|
python3-pip \
|
||||||
|
rpm-ostree \
|
||||||
|
dosfstools \
|
||||||
|
gdisk
|
||||||
|
sudo dnf builddep -y osbuild.spec
|
||||||
|
|
||||||
|
# Install pytst from pip, because the version in some RHEL / CentOS releases is too old
|
||||||
|
sudo pip3 install pytest
|
||||||
|
|
||||||
|
# Make sure that /usr/lib/systemd/boot/efi/linuxx64.efi.stub is available to enable pe32p tests
|
||||||
|
case "${ID}-${VERSION_ID}" in
|
||||||
|
rhel-8.* | centos-8)
|
||||||
|
sudo dnf install -y systemd-udev
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
sudo dnf install -y systemd-boot-unsigned
|
||||||
|
;;
|
||||||
|
esac
|
108
tests/unit-tests/run-unit-tests.sh
Executable file
108
tests/unit-tests/run-unit-tests.sh
Executable file
@ -0,0 +1,108 @@
|
|||||||
|
#!/usr/bin/bash
|
||||||
|
# Execute osbuild unit tests from a checked out dist-git repo
|
||||||
|
|
||||||
|
set -euxo pipefail
|
||||||
|
|
||||||
|
source /etc/os-release
|
||||||
|
|
||||||
|
case "${ID}" in
|
||||||
|
fedora)
|
||||||
|
PKG_MAINT_TOOL="fedpkg"
|
||||||
|
;;
|
||||||
|
rhel)
|
||||||
|
PKG_MAINT_TOOL="rhpkg"
|
||||||
|
;;
|
||||||
|
centos)
|
||||||
|
PKG_MAINT_TOOL="centpkg"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "Error: unsupported OS: ${ID}-${VERSION_ID}"
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
# Move to the checked out git repo with the test plans
|
||||||
|
# this should be the root of the dist-git repo
|
||||||
|
cd "${TMT_TREE}"
|
||||||
|
# the content of the directory is copy of the dist-git repo, but the .git directory is missing
|
||||||
|
# so we need to create it to make all *pkg tools happy
|
||||||
|
git init
|
||||||
|
|
||||||
|
# deduct the release to pass to rpkg to prep the sources.
|
||||||
|
# 1. use the DIST_GIT_RELEASE if set
|
||||||
|
DIST_GIT_RELEASE="${DIST_GIT_RELEASE:-}"
|
||||||
|
# 2. use the TARGET_BRANCH if set
|
||||||
|
if [[ -z "${DIST_GIT_RELEASE}" ]]; then
|
||||||
|
echo "DIST_GIT_RELEASE was not provided, trying to use TARGET_BRANCH"
|
||||||
|
DIST_GIT_RELEASE="${TARGET_BRANCH:-}"
|
||||||
|
fi
|
||||||
|
# 3. use the host OS type and version
|
||||||
|
if [[ -z "${DIST_GIT_RELEASE}" ]]; then
|
||||||
|
echo "DIST_GIT_RELEASE nor TARGET_BRANCH were not provided, trying to use the host OS type and version"
|
||||||
|
case "${ID}" in
|
||||||
|
fedora)
|
||||||
|
DIST_GIT_RELEASE="f${VERSION_ID}"
|
||||||
|
;;
|
||||||
|
rhel)
|
||||||
|
DIST_GIT_RELEASE="rhel-${VERSION_ID}.0"
|
||||||
|
;;
|
||||||
|
centos)
|
||||||
|
DIST_GIT_RELEASE="c${VERSION_ID}s"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
|
||||||
|
# The namespace and name must be passed explicitly to rhpkg, because it can't determine them on its own.
|
||||||
|
# Passing these options to centpkg and fedpkg is harmless, so we can use them for all tools.
|
||||||
|
# shellcheck disable=SC2086
|
||||||
|
${PKG_MAINT_TOOL} -v --namespace rpms --name osbuild --release "${DIST_GIT_RELEASE}" prep
|
||||||
|
|
||||||
|
# Extract the Source0 basename without extension
|
||||||
|
SRC_DIR=$(spectool --source 0 osbuild.spec | sed 's/.\+\(osbuild-[0-9]\+\)\.tar\.gz/\1/')
|
||||||
|
|
||||||
|
cd "${SRC_DIR}"
|
||||||
|
|
||||||
|
# Some unit tests depend on the fact that the source code is in a git repo
|
||||||
|
git init .
|
||||||
|
git add *
|
||||||
|
git commit -m "Initial commit"
|
||||||
|
|
||||||
|
# The 'test/run/test_assemblers.py::test_tar' test case uses system tar to extract the built tar archive.
|
||||||
|
# However, files in the tar archive can have SELinux context not present in the system policy. Therefore,
|
||||||
|
# in order for the system tar to be able to set it when extracting the archive, it must be labeled with
|
||||||
|
# 'install_exec_t' type.
|
||||||
|
|
||||||
|
ORIGINAL_TAR_CONTEXT="$(matchpathcon -n "$(which tar)")"
|
||||||
|
sudo chcon "system_u:object_r:install_exec_t:s0" "$(which tar)"
|
||||||
|
function restore_tar_context() {
|
||||||
|
sudo chcon "${ORIGINAL_TAR_CONTEXT}" "$(which tar)"
|
||||||
|
}
|
||||||
|
trap restore_tar_context EXIT
|
||||||
|
|
||||||
|
# Run the unit tests
|
||||||
|
# Note:
|
||||||
|
# - Ignore the boot test, because it requires qemu-system-x86_64 not available on all distributions.
|
||||||
|
# - Ignore source code tests, which run linters, since we can't ensure that all linters are available
|
||||||
|
# and of the same version as in upstream.
|
||||||
|
# - Explicitly mark btrfs as unsupported on CentOS / RHEL
|
||||||
|
|
||||||
|
if [ "${ID}" == "centos" ] || [ "${ID}" == "rhel" ]; then
|
||||||
|
UNSUPPORTED_FS="--unsupported-fs btrfs"
|
||||||
|
fi
|
||||||
|
|
||||||
|
TEST_SELECTION_EXPR="not (TestBoot and boot)"
|
||||||
|
|
||||||
|
# disable some tests on RHEL-8
|
||||||
|
if ([ "${ID}" == "rhel" ] || [ "${ID}" == "centos" ]) && [ "${VERSION_ID%%.*}" == "8" ]; then
|
||||||
|
# qemu-img info in RHEL-8 produces "raw" as the image format for "vdi" images, which causes tests to fail. Skip it.
|
||||||
|
TEST_SELECTION_EXPR="${TEST_SELECTION_EXPR} and not (test_qemu[ext4-vdi] or test_qemu[xfs-vdi])"
|
||||||
|
TEST_SELECTION_EXPR="${TEST_SELECTION_EXPR} and not (TestStages and test_qemu)"
|
||||||
|
fi
|
||||||
|
|
||||||
|
sudo python3 -m pytest \
|
||||||
|
--rootdir "$(pwd)" \
|
||||||
|
--ignore "$(pwd)/test/src" \
|
||||||
|
${UNSUPPORTED_FS:-} \
|
||||||
|
-k "${TEST_SELECTION_EXPR}" \
|
||||||
|
-v \
|
||||||
|
"$(pwd)/test/"
|
Loading…
Reference in New Issue
Block a user