test: move to koji-osbuild-tests package

This is similar to how other osbuild packages are testing: everything
that's needed for testing is included in the tests package or a
dependency of it. The test runner then runs every executable in
/usr/libexec/tests/<packagename>. This gives a simple test API to
projects depending on this package (notably osbuild-composer).

The local development workflow described in HACKING.md is meant to
continue to work. To ensure this, all relevant scripts gained a
TEST_DATA variable, which defaults to `./test`, but is set from $1 to
the installed path from integration.sh.
This commit is contained in:
Lars Karlitski 2020-11-19 00:05:36 +01:00
parent ade02b0c9a
commit 16f762c2ed
14 changed files with 132 additions and 64 deletions

View file

@ -15,18 +15,10 @@ if [[ $ID == rhel ]] && ! rpm -q epel-release; then
sudo rpm -Uvh /tmp/epel.rpm
fi
greenprint "Installing required packages"
sudo dnf -y install \
container-selinux \
dnsmasq \
jq \
krb5-workstation \
koji \
koji-osbuild-cli \
podman
# HACK: podman-plugins was only recently added to RHEL. Fetch it from the
# internal RHEL 8.3.1 repository until that is released.
# internal RHEL 8.3.1 repository until that is released. On Fedora,
# podman-plugins is installed in the koji-osbuild-tests package. Please adjust
# the spec file to do the same on RHEL before removing this block.
greenprint "Install the podman dnsname plugin"
if [[ $ID == rhel ]]; then
sudo tee /etc/yum.repos.d/rhel-8-3-1.repo << EOF
@ -38,8 +30,6 @@ gpgcheck = 1
EOF
sudo dnf -y install '--disablerepo=*' --enablerepo=rhel-8-3-1 podman-plugins
else
sudo dnf -y install podman-plugins
fi
greenprint "Fetching RPMs"
@ -51,37 +41,40 @@ sudo dnf -y \
"koji-osbuild*"
greenprint "Creating composer SSL certificates"
sudo test/make-certs.sh
sudo /usr/libexec/koji-osbuild-tests/make-certs.sh /usr/share/koji-osbuild-tests
greenprint "Starting osbuild-composer's socket"
sudo systemctl enable --now osbuild-composer-api.socket
greenprint "Building containers"
sudo test/build-container.sh
sudo /usr/libexec/koji-osbuild-tests/build-container.sh /usr/share/koji-osbuild-tests
greenprint "Starting containers"
sudo test/run-koji-container.sh start
sudo /usr/libexec/koji-osbuild-tests/run-koji-container.sh start
greenprint "Print logs"
sudo podman logs org.osbuild.koji.koji
greenprint "Copying credentials and certificates"
sudo test/copy-creds.sh
sudo /usr/libexec/koji-osbuild-tests/copy-creds.sh /usr/share/koji-osbuild-tests
greenprint "Testing Koji hub API access"
koji --server=http://localhost:8080/kojihub --user=osbuild --password=osbuildpass --authtype=password hello
greenprint "Starting koji builder"
sudo test/run-builder.sh start
sudo /usr/libexec/koji-osbuild-tests/run-builder.sh start /usr/share/koji-osbuild-tests
greenprint "Creating Koji tag infrastructure"
test/make-tags.sh
/usr/libexec/koji-osbuild-tests/make-tags.sh
greenprint "Running integration tests"
python3 -m unittest discover -v test/integration/
python3 -m unittest discover -v /usr/libexec/koji-osbuild-tests/integration/
greenprint "Stopping koji builder"
sudo test/run-builder.sh stop
sudo /usr/libexec/koji-osbuild-tests/run-builder.sh stop /usr/share/koji-osbuild-tests
greenprint "Stopping containers"
sudo test/run-koji-container.sh stop
sudo /usr/libexec/koji-osbuild-tests/run-koji-container.sh stop
greenprint "Removing generated CA cert"
sudo rm /etc/pki/ca-trust/source/anchors/osbuild-ca-crt.pem