1
0
mirror of https://github.com/mail-in-a-box/mailinabox.git synced 2025-04-12 01:37:07 +00:00

Add options to 1. re-use existing an existing backup 2. disable test runner

This commit is contained in:
downtownallday 2022-09-20 10:15:36 -04:00
parent f321271e1c
commit 39aaf94e7b

View File

@ -14,14 +14,18 @@ cd $(dirname "$0")
source ../../lib/color-output.sh source ../../lib/color-output.sh
warn "Destroy existing VMs" artifact_dir_local="$(dirname "$0")/../../out/majorupgrade_artifacts"
vagrant destroy -f artifact_dir_vm="/mailinabox/tests/out/majorupgrade_artifacts"
artifact_dir_local="$(dirname "$0")/../../out/majorupgrade"
artifact_dir_vm="/mailinabox/tests/out/majorupgrade"
oldvm="major-upgrade-oldvm" oldvm="major-upgrade-oldvm"
newvm="major-upgrade-newvm" newvm="major-upgrade-newvm"
warn "Artifacts directory: $(realpath "$artifact_dir_local")"
warn "Destroy existing VMs"
vagrant destroy -f
if [ "$1" != "--no-oldvm" ]; then
# #
# bring up oldvm # bring up oldvm
# ... then install, populate, and backup # ... then install, populate, and backup
@ -44,6 +48,11 @@ vagrant ssh $oldvm -- "cd \"$artifact_dir_vm\" || exit 1; sudo -H cp -R /tmp/sta
warn "Destroy $oldvm - no longer needed" warn "Destroy $oldvm - no longer needed"
vagrant destroy $oldvm -f vagrant destroy $oldvm -f
else
# remove --no-oldvm from argument list
shift
fi
# #
# bring up newvm # bring up newvm
@ -62,6 +71,12 @@ vagrant up $newvm || exit 1
vagrant ssh $newvm -- "cd /mailinabox; sudo -H bash -c 'source tests/lib/all.sh; installed_state_compare $artifact_dir_vm/state /tmp/state/newvm'" || exit 2 vagrant ssh $newvm -- "cd /mailinabox; sudo -H bash -c 'source tests/lib/all.sh; installed_state_compare $artifact_dir_vm/state /tmp/state/newvm'" || exit 2
# run tests # run tests
if [ "$1" != "--no-tests" ]; then
vagrant ssh $newvm -- "cd /mailinabox; sudo -H tests/runner.sh upgrade-basic upgrade-totpuser default" || exit 3 vagrant ssh $newvm -- "cd /mailinabox; sudo -H tests/runner.sh upgrade-basic upgrade-totpuser default" || exit 3
else
# remove --no-tests from argument list
shift
fi
success 'Success' success 'Success'