cockpit/tests/run-test.sh

87 lines
2.4 KiB
Bash
Raw Normal View History

#!/bin/sh
set -eux
. /etc/os-release
if ls $(pwd)/cockpit-appstream* 1> /dev/null 2>&1; then
test_optional=1
else
test_basic=1
fi
if [ "$ID" = "fedora" ]; then
test_basic=1
test_optional=1
fi
# tests need cockpit's bots/ libraries
cd "$SOURCE"
git clone --depth=1 https://github.com/cockpit-project/bots
if [ -n "$test_optional" ]; then
# pre-download cirros image for Machines tests
bots/image-download cirros
fi
# only install a subset to save time/space
npm install axe-core chrome-remote-interface sizzle
export TEST_OS="${ID}-${VERSION_ID/./-}"
# HACK: upstream does not yet know about fedora rawhide
if [ "$TEST_OS" = "fedora-33" ]; then
export TEST_OS=fedora-32
fi
# select tests
TESTS=""
RC=0
if [ -n "$test_optional" ]; then
# some tests are still too unstable: testCreate,testNetworkSettings,testVmNICs
# testAddDisk triggers SELinux violation
TESTS="$TESTS
TestMachines.test{Basic,VCPU,MultipleSettings,BootOrder,Libvirt}
TestMachines.testDetachDisk
TestMachines.test{InlineConsole,ExternalConsole,SerialConsole}
TestMachines.test{StoragePools,StoragePoolsCreate,NICAdd}"
# not all classes are nondestructive, and we can't run rebooting tests
TESTS="$TESTS
TestUpdates.test{Basic,SecurityOnly}
TestAutoUpdates"
# FIXME: storage test classes are all called TestStorage, doesn't work with run-tests selection
for t in storage-basic \
storage-ignored \
storage-partitions \
storage-used \
storage-lvm2; do
test/verify/check-$t -tv --machine localhost:22 --browser localhost:9090 || RC=$?
done
fi
if [ -n "$test_basic" ]; then
# TestFirewall.testNetworkingPage is still too unstable
TESTS="$TESTS TestFirewall.test{AddCustomServices,AddServices,FirewallPage,MultipleZones}"
TESTS="$TESTS
TestAccounts
TestLogin
TestNetworking
TestSOS"
fi
# execute run-tests
test/common/run-tests --test-dir test/verify --trace --verbose --nondestructive \
--machine localhost:22 --browser localhost:9090 $TESTS || RC=$?
# check-menu is not @nondestructive yet, keep it last
if [ -n "$test_basic" ]; then
test/verify/check-menu -tv --machine localhost:22 --browser localhost:9090 || RC=$?
fi
echo $RC > "$LOGS/exitcode"
cp --verbose Test* "$LOGS" || true
# deliver test result via exitcode file
exit 0