mirror of
https://github.com/YunoHost-Apps/mattermost_ynh.git
synced 2024-09-03 19:36:29 +02:00
test: remove custom tests
This commit is contained in:
parent
00b1605e47
commit
e4710188d6
1 changed files with 0 additions and 69 deletions
69
test.sh
69
test.sh
|
@ -57,42 +57,6 @@ function _vagrant_ssh() {
|
|||
return $exit_code
|
||||
}
|
||||
|
||||
function _assert_success() {
|
||||
local message="$1"
|
||||
local command="$2"
|
||||
if [ -z "$command" ]; then
|
||||
echo "Invalid arguments: command missing."
|
||||
echo "Usage: _assert_success <message> <command>"
|
||||
return -1
|
||||
fi
|
||||
|
||||
local RED=`tput setaf 1`
|
||||
local GREEN=`tput setaf 2`
|
||||
local BOLD=`tput bold`
|
||||
local RESET=`tput sgr0`
|
||||
|
||||
set +e # Allow continuing the script on failures
|
||||
if _vagrant_ssh "$command"; then
|
||||
printf "[${GREEN}${BOLD}OK${RESET}] $message\n"
|
||||
else
|
||||
printf "[${RED}${BOLD}KO${RESET}] $message\n"
|
||||
fi
|
||||
set -e # Fail again on first error
|
||||
}
|
||||
|
||||
function _assert_mattermost_frontpage_up() {
|
||||
local domain="$1"
|
||||
|
||||
# On the default Yunohost Vagrant box, this file
|
||||
# bypass all SSOWAT configurations, and redirects the root of the domain to the SSO login form.
|
||||
# We need to access the frontpage, so we remove this bypass.
|
||||
_vagrant_ssh "sudo rm -f /etc/ssowat/conf.json.persistent"
|
||||
|
||||
_assert_success \
|
||||
"Mattermost frontpage is reachable" \
|
||||
"curl --silent --show-error --insecure -L -H 'Host: ${DOMAIN}' --resolve ${DOMAIN}:443:127.0.0.1 https://${DOMAIN}/ | grep -q 'Mattermost'"
|
||||
}
|
||||
|
||||
function setup() {
|
||||
if $SKIP_SNAPSHOT; then
|
||||
echo "--- Starting Vagrant box ---"
|
||||
|
@ -112,34 +76,6 @@ function setup() {
|
|||
fi
|
||||
}
|
||||
|
||||
function test_simple_install() {
|
||||
echo "--- Running simple installation test ---"
|
||||
_vagrant_ssh "sudo yunohost app install '$APP_DIR' --args 'domain=${DOMAIN}&public_site=Yes&analytics=0' $VERBOSE_OPT"
|
||||
_assert_mattermost_frontpage_up "$DOMAIN"
|
||||
}
|
||||
|
||||
function test_simple_upgrade() {
|
||||
echo "--- Running simple upgrade test ---"
|
||||
_vagrant_ssh "sudo yunohost app upgrade $APP_NAME --file '$APP_DIR' $VERBOSE_OPT"
|
||||
_assert_mattermost_frontpage_up "$DOMAIN"
|
||||
}
|
||||
|
||||
function test_simple_backup() {
|
||||
echo "--- Running simple backup test ---"
|
||||
_vagrant_ssh "sudo yunohost backup create --name mattermost-test-backup --ignore-system $VERBOSE_OPT --apps $APP_NAME"
|
||||
}
|
||||
|
||||
function test_simple_remove() {
|
||||
echo "--- Running simple remove test ---"
|
||||
_vagrant_ssh "sudo yunohost app remove $APP_NAME"
|
||||
}
|
||||
|
||||
function test_simple_restore() {
|
||||
echo "--- Running simple restore test ---"
|
||||
_vagrant_ssh "sudo yunohost backup restore mattermost-test-backup --force --ignore-system $VERBOSE_OPT --apps $APP_NAME"
|
||||
_assert_mattermost_frontpage_up "$DOMAIN"
|
||||
}
|
||||
|
||||
function test_package_check() {
|
||||
echo "--- Running package_check ---"
|
||||
_vagrant_ssh "package_check/package_check.sh --build-lxc --bash-mode '$APP_DIR'"
|
||||
|
@ -152,9 +88,4 @@ function teardown() {
|
|||
_parse_args $*
|
||||
setup
|
||||
test_package_check
|
||||
test_simple_install
|
||||
test_simple_upgrade
|
||||
test_simple_backup
|
||||
test_simple_remove
|
||||
test_simple_restore
|
||||
teardown
|
||||
|
|
Loading…
Add table
Reference in a new issue