70257534e1
Re-use the test skeleton from cockpit. Just run a single integration test for now, until we make them properly @nondestructive upstream [1]. Run chromium and the test directly on the test bed. For cockpit-podman tests it's not practical to run them in a cockpit/tasks podman container, as that container interferes too much with the tests. [1] https://github.com/cockpit-project/cockpit-podman/pull/356
57 lines
1.5 KiB
Bash
Executable File
57 lines
1.5 KiB
Bash
Executable File
#!/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
|