Blob Blame History Raw
#!/bin/sh
set -eux

# HACK: this should be a var: https://pagure.io/standard-test-roles/issue/263
SOURCE=/var/str/source

# HACK: reset the journal (tests should only look at the relevant portion)
rm -rf /var/log/journal/*
systemctl restart systemd-journald

# create user account for logging in
if ! id admin 2>/dev/null; then
    useradd admin -G wheel
    echo admin:foobar | chpasswd
fi

# 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.
RC=0
cat <<EOF | podman run --rm -i docker.io/cockpit/tests:2018-11-09 /bin/sh -eux || RC=$?
# CSP does not like the the invalid host name _gateway, so translate it
HOST=\$(getent hosts _gateway | cut -f1 -d' ')

# copy source dir, otherwise it's owned by root:root and not chown'able
cp -a cockpit /tmp/
cd /tmp/cockpit

# check out current rhel-x branch to get the tests; they are not shipped in the source
git fetch origin rhel-x
git checkout FETCH_HEAD

export TEST_OS=rhel-x
test/verify/check-menu -tv --machine \$HOST:22 --browser \$HOST:9090
EOF

# 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

exit $RC