separate occ and install tests

This commit is contained in:
Christopher Engelhard 2020-11-14 15:14:51 +01:00
commit 01b481fb3a
3 changed files with 69 additions and 6 deletions

View file

@ -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

48
tests/cli-install/test.sh Executable file
View file

@ -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

View file

@ -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"