starter-kit/test/browser/run-test.sh
Allison Karlitskaya 2e8b932ece test/browser: run tests inside the tasks container
This simplifies the "outside" setup quite a bit and gives us the same
tasks container that test runs on the Cockpit CI run under.

This change also implicitly changes the test browser to chromium (which
is no longer an issue — we just use it from the tasks container).
2024-03-15 15:22:56 +01:00

47 lines
1.3 KiB
Bash

set -eux
cd "${SOURCE}"
# tests need cockpit's bots/ libraries and test infrastructure
git init
rm -f bots # common local case: existing bots symlink
make bots test/common
# support running from clean git tree
if [ ! -d node_modules/chrome-remote-interface ]; then
# copy package.json temporarily otherwise npm might try to install the dependencies from it
rm -f package-lock.json # otherwise the command below installs *everything*, argh
mv package.json .package.json
# only install a subset to save time/space
npm install chrome-remote-interface
mv .package.json package.json
fi
# disable detection of affected tests; testing takes too long as there is no parallelization
mv .git dot-git
. /etc/os-release
export TEST_OS="${ID}-${VERSION_ID/./-}"
if [ "${TEST_OS#centos-}" != "$TEST_OS" ]; then
TEST_OS="${TEST_OS}-stream"
fi
EXCLUDES=""
# make it easy to check in logs
echo "TEST_ALLOW_JOURNAL_MESSAGES: ${TEST_ALLOW_JOURNAL_MESSAGES:-}"
echo "TEST_AUDIT_NO_SELINUX: ${TEST_AUDIT_NO_SELINUX:-}"
GATEWAY="$(python3 -c 'import socket; print(socket.gethostbyname("_gateway"))')"
RC=0
./test/common/run-tests \
--nondestructive \
--machine "${GATEWAY}":22 \
--browser "${GATEWAY}":9090 \
$EXCLUDES \
|| RC=$?
echo $RC > "$LOGS/exitcode"
cp --verbose Test* "$LOGS" || true
exit $RC