cockpit/tests/verify.sh
Martin Pitt 15c2932687 tests: Split host and container run scripts
This fixes trap handling and also is easier to write and debug.
2020-04-06 20:44:29 +02:00

40 lines
1.4 KiB
Bash
Executable File

#!/bin/sh
set -eux
# from standard-test-source
SOURCE="$(pwd)/source"
LOGS="$(pwd)/logs"
TESTS="$(pwd)/tests"
mkdir -p "$LOGS"
chmod a+w "$LOGS"
# create user account for logging in
if ! id admin 2>/dev/null; then
useradd -c Administrator -G wheel admin
echo admin:foobar | chpasswd
fi
# disable core dumps, we rather investigate them upstream where test VMs are accessible
echo core > /proc/sys/kernel/core_pattern
# make sure that we can access cockpit through the firewall
systemctl start firewalld
firewall-cmd --add-service=cockpit --permanent
firewall-cmd --add-service=cockpit
# The cockpit/tests container has chromium-browser and other test
# dependencies, which we don't have on RHEL itself. Also, we don't actually
# want to install these on the tested image, so run the test in a container,
# which tests the host. Use a fixed tag to avoid running into failures with
# "latest", as we don't gate container updates on the dist-git tests for now.
podman run --rm -i -v "$SOURCE:/source:ro,Z" -v "$TESTS:/tests:ro,Z" -v "$LOGS:/logs:Z" docker.io/cockpit/tasks:2020-01-30 /tests/container-run.sh || true
# reset system changes from verify tests, for running this multiple times in a row
# HACK: Isolate tests from each other: https://pagure.io/fedora-ci/general/issue/11
rm -f /etc/systemd/system/cockpit.service.d/notls.conf
systemctl daemon-reload
systemctl stop cockpit.service
RC=$(cat $LOGS/exitcode)
exit ${RC:-1}