tests: Sync with downstream RHEL

This commit is contained in:
Martin Pitt 2019-07-30 11:07:45 +02:00
parent 2d91976d68
commit 0b229db4b1
2 changed files with 21 additions and 14 deletions

View File

@ -21,3 +21,4 @@
- verify:
dir: .
run: ./verify.sh
save-files: ["logs/*"]

View File

@ -1,12 +1,13 @@
#!/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
# from standard-test-source
SOURCE="$(pwd)/source"
LOGS="$(pwd)/logs"
mkdir -p "$LOGS"
chmod a+w "$LOGS"
# these get mounted into the tasks container
chcon -Rt container_file_t "$SOURCE" "$LOGS"
# create user account for logging in
if ! id admin 2>/dev/null; then
@ -20,19 +21,24 @@ fi
# 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=$?
cat <<EOF | podman run --rm -i -v "$SOURCE:/source:ro" -v "$LOGS:/logs" docker.io/cockpit/tasks:2019-06-03 /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
trap "cp --verbose Test* /logs/ || true" EXIT
# 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
# tests need cockpit's bots/ libraries
cd /tmp
git clone --depth=1 https://github.com/cockpit-project/cockpit
cd cockpit
# copy tests from our source, so that they match the released version
rm -rf test
cp -a /source/test .
export TEST_OS=rhel-x
# only install a subset to save time/space
npm install axe-core chrome-remote-interface sizzle
export TEST_OS=fedora-30
test/verify/check-menu -tv --machine \$HOST:22 --browser \$HOST:9090
EOF