Skip to content

Commit

Permalink
Add test that both instances are still running (lxd only)
Browse files Browse the repository at this point in the history
Remove "set -e", presuming that this fix will be merged:
juju#12140
  • Loading branch information
benhoyt committed Oct 20, 2020
1 parent f3116d0 commit 6bd4b75
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions tests/suites/backup_restore/backup_restore.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
run_basic_backup_create() {
set -e # TODO benhoyt: remove once "set +e" issue is fixed
echo

juju switch controller
Expand All @@ -16,7 +15,6 @@ run_basic_backup_create() {
}

run_basic_backup_restore() {
set -e # TODO benhoyt: remove once "set +e" issue is fixed
echo

wget -O "${TEST_DIR}/juju-restore" https://github.com/juju/juju-restore/releases/latest/download/juju-restore
Expand All @@ -30,15 +28,18 @@ run_basic_backup_restore() {
juju deploy cs:~jameinel/ubuntu-lite-7
wait_for "ubuntu-lite" "$(idle_condition "ubuntu-lite")"
juju status --format json | jq '.machines | length' | check 1
id0=$(juju status --format json | jq -r '.machines["0"]["instance-id"]')

echo "Create a backup"
juju switch controller
juju switch controller # create-backup only works from controller model
juju create-backup --filename "${TEST_DIR}/basic_backup.tar.gz"

echo "Add another machine (after the backup)"
juju switch test-basic-backup-restore
juju add-unit ubuntu-lite
wait_for_machine_agent_status "1" "started"
juju status --format json | jq '.machines | length' | check 2
id1=$(juju status --format json | jq -r '.machines["1"]["instance-id"]')

echo "Restore the backup"
juju switch controller
Expand All @@ -51,6 +52,13 @@ run_basic_backup_restore() {
wait_for "ubuntu-lite" "$(idle_condition "ubuntu-lite")"
juju status --format json | jq '.machines | length' | check 1

# Only do this check if provider is LXD (too hard to do for all providers)
if [ "${BOOTSTRAP_PROVIDER}" == "lxd" ] || [ "${BOOTSTRAP_PROVIDER}" == "localhost" ]; then
echo "Ensure that both instances are running (restore shouldn't terminate machines)"
lxc info "${id0}" | grep Status | check Running
lxc info "${id1}" | grep Status | check Running
fi

destroy_model "test-basic-backup-restore"
}

Expand Down

0 comments on commit 6bd4b75

Please sign in to comment.