test: 'run-test.sh' can decide which tests to run

We currently have 3 versions of this script (one in fedora, one in rhel
cockpit and one in rhel cockpit-appstream).
With this patch we can keep this same file in all 3.

Also backporting hack in verify.sh.
This commit is contained in:
Matej Marusak 2020-05-15 13:37:09 +02:00 committed by mmarusak
parent 8f952d3560
commit b6bc45dfef
2 changed files with 51 additions and 27 deletions

View File

@ -1,15 +1,31 @@
#!/bin/sh #!/bin/sh
set -eux 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 # tests need cockpit's bots/ libraries
cd "$SOURCE" cd "$SOURCE"
git clone --depth=1 https://github.com/cockpit-project/bots git clone --depth=1 https://github.com/cockpit-project/bots
# pre-download cirros image for Machines tests
bots/image-download cirros 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 # only install a subset to save time/space
npm install axe-core chrome-remote-interface sizzle npm install axe-core chrome-remote-interface sizzle
. /etc/os-release
export TEST_OS="${ID}-${VERSION_ID/./-}" export TEST_OS="${ID}-${VERSION_ID/./-}"
# HACK: upstream does not yet know about fedora rawhide # HACK: upstream does not yet know about fedora rawhide
if [ "$TEST_OS" = "fedora-33" ]; then if [ "$TEST_OS" = "fedora-33" ]; then
@ -18,32 +34,40 @@ fi
RC=0 RC=0
# some tests are still too unstable: testCreate,testNetworkSettings,testVmNICs if [ -n "$test_optional" ]; then
# testAddDisk triggers SELinux violation # some tests are still too unstable: testCreate,testNetworkSettings,testVmNICs
test/verify/check-machines -tv --machine localhost:22 --browser localhost:9090 \ # testAddDisk triggers SELinux violation
TestMachines.test{Basic,VCPU,MultipleSettings,BootOrder,Libvirt} \ test/verify/check-machines -tv --machine localhost:22 --browser localhost:9090 \
TestMachines.testDetachDisk \ TestMachines.test{Basic,VCPU,MultipleSettings,BootOrder,Libvirt} \
TestMachines.test{InlineConsole,ExternalConsole,SerialConsole} \ TestMachines.testDetachDisk \
TestMachines.test{StoragePools,StoragePoolsCreate,NICAdd} || RC=$? TestMachines.test{InlineConsole,ExternalConsole,SerialConsole} \
TestMachines.test{StoragePools,StoragePoolsCreate,NICAdd} || RC=$?
# TestFirewall.testNetworkingPage is still too unstable # not all classes are nondestructive, and we can't run rebooting tests
test/verify/check-networking-firewall -tv --machine localhost:22 --browser localhost:9090 \ test/verify/check-packagekit -tv --machine localhost:22 --browser localhost:9090 TestUpdates.test{Basic,SecurityOnly} TestAutoUpdates || RC=$?
TestFirewall.test{AddCustomServices,AddServices,FirewallPage,MultipleZones} || RC=$?
# not all classes are nondestructive, and we can't run rebooting tests for t in storage-basic \
test/verify/check-packagekit -tv --machine localhost:22 --browser localhost:9090 TestUpdates.test{Basic,SecurityOnly} TestAutoUpdates || RC=$? storage-ignored \
storage-partitions \
storage-used storage-lvm2; do
test/verify/check-$t -tv --machine localhost:22 --browser localhost:9090 || RC=$?
done
fi
# check-menu is not @nondestructive yet, keep it last if [ -n "$test_basic" ]; then
for t in accounts \ # TestFirewall.testNetworkingPage is still too unstable
login \ test/verify/check-networking-firewall -tv --machine localhost:22 --browser localhost:9090 \
networking-basic \ TestFirewall.test{AddCustomServices,AddServices,FirewallPage,MultipleZones} || RC=$?
sosreport storage-basic \
storage-ignored \ # check-menu is not @nondestructive yet, keep it last
storage-partitions \ for t in accounts \
storage-used storage-lvm2 \ login \
menu; do networking-basic \
test/verify/check-$t -tv --machine localhost:22 --browser localhost:9090 || RC=$? sosreport \
done menu; do
test/verify/check-$t -tv --machine localhost:22 --browser localhost:9090 || RC=$?
done
fi
echo $RC > "$LOGS/exitcode" echo $RC > "$LOGS/exitcode"
cp --verbose Test* "$LOGS" || true cp --verbose Test* "$LOGS" || true

View File

@ -10,7 +10,7 @@ chmod a+w "$LOGS"
# install browser; on RHEL, use chromium from epel # install browser; on RHEL, use chromium from epel
if ! rpm -q chromium-headless; then if ! rpm -q chromium-headless; then
if grep -q 'ID=rhel' /etc/os-release; then if grep -q 'ID=.*rhel' /etc/os-release; then
dnf install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm dnf install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
dnf config-manager --enable epel dnf config-manager --enable epel
fi fi