diff --git a/tests/cli-install/main.fmf b/tests/cli-install/main.fmf new file mode 100644 index 0000000..1a52901 --- /dev/null +++ b/tests/cli-install/main.fmf @@ -0,0 +1,5 @@ +summary: Test of post-install tasks using occ cli +description: >- + Performs basic test of Nextcloud installation using occ. This is also run when the user first accesses a newly + installed Nextcloud instance, so this should not fail. +tier: 1 diff --git a/tests/cli-install/test.sh b/tests/cli-install/test.sh new file mode 100755 index 0000000..b33cc35 --- /dev/null +++ b/tests/cli-install/test.sh @@ -0,0 +1,48 @@ +#!/bin/bash +# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k +. /usr/share/beakerlib/beakerlib.sh || exit 1 + +# list of packages to check the installation status of +# can be used to test correct dependencies +# installation should be done via packages: in .fmf file +PACKAGES=${PACKAGES:-"nextcloud"} + +installdir="/usr/share/nextcloud" +datadir="/var/lib/nextcloud/data" + +rlJournalStart + # setup + rlPhaseStartSetup + # check that all packages are installed and correct + # directories have been created + rlAssertRpm --all + rlAssertExists "$installdir" + rlAssertExists "$datadir" + # switch to installdir to run occ + rlRun "pushd $installdir" 0 "Switch to nextcloud directory" + rlPhaseEnd + + # run tests + rlPhaseStartTest + # check installation status + # occ should + # - report that nextcloud is not installed + rlLog "Checking installation status" + rlRun -s "sudo -u apache php occ status" 0 "Run 'occ status'" + rlAssertGrep "installed: false" "$rlRun_LOG" + # perform minimal install + # occ should + # - successfully set up Nextcloud + # - report that Nextcloud is installed afterwards + rlRun -s "sudo -u apache php occ maintenance:install --data-dir=$datadir --admin-pass=admin" 0 "Run 'occ maintenance:install'" + rlAssertGrep "successfully installed" "$rlRun_LOG" + rlRun -s "sudo -u apache php occ status" 0 "Check install status" + rlAssertGrep "installed: true" "$rlRun_LOG" + rlPhaseEnd + + # cleanup + rlPhaseStartCleanup + rlRun "rm $rlRun_LOG" + rlRun "popd" + rlPhaseEnd +rlJournalEnd diff --git a/tests/occ/test.sh b/tests/occ/test.sh index dd0e2ac..9145ffc 100755 --- a/tests/occ/test.sh +++ b/tests/occ/test.sh @@ -2,30 +2,40 @@ # vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k . /usr/share/beakerlib/beakerlib.sh || exit 1 +# list of packages to check the installation status of +# can be used to test correct dependencies +# installation should be done via packages: in .fmf file PACKAGES=${PACKAGES:-"nextcloud"} +# We want to fail the test if no version is passed +VERSION=${VERSION:-"MISSINGVER"} installdir="/usr/share/nextcloud" datadir="/var/lib/nextcloud/data" rlJournalStart + # setup rlPhaseStartSetup + # check that all packages are installed and correct + # directories have been created rlAssertRpm --all rlAssertExists "$installdir" rlAssertExists "$datadir" - rlRun "pushd $installdir" 0 "Switch to nextcloud directory" + # switch to installdir to run occ + rlRun "cd $installdir" 0 "Switch to nextcloud directory" rlPhaseEnd + # run tests rlPhaseStartTest + # test if occ works at all + # occ should + # - work when invoked as ./occ + # - return the correct version string rlLog "Testing basic occ functionality" rlRun -s "sudo -u apache php occ status" 0 "Run 'occ status'" rlAssertGrep "versionstring: $VERSION" "$rlRun_LOG" - rlAssertGrep "installed: false" "$rlRun_LOG" - rlRun -s "sudo -u apache php occ maintenance:install --data-dir=$datadir --admin-pass=admin" 0 "Run 'occ maintenance:install'" - rlAssertGrep "successfully installed" "$rlRun_LOG" - rlRun -s "sudo -u apache php occ status" 0 "Check install status" - rlAssertGrep "installed: true" "$rlRun_LOG" rlPhaseEnd + # cleanup rlPhaseStartCleanup rlRun "rm $rlRun_LOG" rlRun "popd"