martinpitt / rpms / cockpit

Forked from rpms/cockpit 4 years ago
Clone
Blob Blame History Raw
#!/bin/sh
set -eux

. /etc/os-release
test_optional=
test_basic=

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

# 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

# HACK: CI hits this selinux denial. Unrelated to our tests.
export TEST_ALLOW_JOURNAL_MESSAGES=".*Permission denied: '/var/cache/app-info/xmls/beakerlib-libraries.xml'"

# select tests
TESTS=""
RC=0
if [ -n "$test_optional" ]; then
    # pre-download cirros image for Machines tests
    bots/image-download cirros

    # 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
         TestStorage"
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