nextcloud/tests/cli-install/test.sh
2020-12-17 12:47:20 +01:00

48 lines
1.6 KiB
Bash
Executable file

#!/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 ./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