cockpit-podman/tests/browser.sh

57 lines
1.5 KiB
Bash
Raw Normal View History

#!/bin/sh
set -eux
# from standard-test-source
SOURCE="$(pwd)/source"
LOGS="$(pwd)/logs"
mkdir -p "$LOGS"
chmod a+w "$LOGS"
# create user account for logging in
if ! id admin 2>/dev/null; then
useradd admin -G wheel
echo admin:foobar | chpasswd
fi
# avoid sudo lecture during tests
su -c 'echo foobar | sudo --stdin whoami' - admin
# disable core dumps, we rather investigate them upstream where test VMs are accessible
echo core > /proc/sys/kernel/core_pattern
# pull images for system podman tests
podman pull docker.io/busybox
podman pull docker.io/alpine
podman pull docker.io/registry:2
# pull images for user podman tests; podman insists on user session
loginctl enable-linger $(id -u admin)
sudo -i -u admin bash << EOF
podman pull docker.io/busybox
podman pull docker.io/alpine
podman pull docker.io/registry:2
EOF
systemctl enable --now cockpit.socket io.podman.socket
# tests need cockpit's bots/ libraries and test infrastructure
cd $SOURCE
git init
make bots test/common
# only install a subset to save time/space
npm install chrome-remote-interface sizzle
export TEST_OS=fedora-32
export TEST_AUDIT_NO_SELINUX=1
# run tests
RC=0
test/check-application -tv --machine 127.0.0.1:22 --browser 127.0.0.1:9090 TestApplication.testBasicSystem || { RC=$? ; cp --verbose Test* $LOGS || true; }
# reset system changes from tests, for running this multiple times in a row
rm -f /etc/systemd/system/cockpit.service.d/notls.conf
systemctl daemon-reload
systemctl stop cockpit.service
exit $RC