diff --git a/lib/lxc.sh b/lib/lxc.sh index f22d098..a1dc9f2 100644 --- a/lib/lxc.sh +++ b/lib/lxc.sh @@ -44,7 +44,7 @@ CREATE_LXC_SNAPSHOT () { } LOAD_LXC_SNAPSHOT () { - snapname=$1 + local snapname=$1 log_debug "Loading snapshot $snapname ..." sudo lxc stop --timeout 15 $LXC_NAME 2>/dev/null sudo lxc restore $LXC_NAME $snapname diff --git a/lib/tests.sh b/lib/tests.sh index a661eb2..a474a0a 100644 --- a/lib/tests.sh +++ b/lib/tests.sh @@ -69,6 +69,7 @@ _LOAD_SNAPSHOT_OR_INSTALL_APP () { if ! LXC_SNAPSHOT_EXISTS $snapname then + log_warning "Expected to find an existing snapshot $snapname but it doesn't exist yet .. will attempt to create it" LOAD_LXC_SNAPSHOT snap0 \ &&_INSTALL_APP "path=$check_path" \ && log_debug "(Creating a snapshot for $_install_type installation.)" \ @@ -314,14 +315,14 @@ _TEST_MULTI_INSTANCE () { LOAD_LXC_SNAPSHOT snap0 - log_small_title "First installation: path=$DOMAIN$check_path" \ + log_small_title "First installation: path=$SUBDOMAIN$check_path" \ && _LOAD_SNAPSHOT_OR_INSTALL_APP "$check_path" \ - && log_small_title "Second installation: path=$SUBDOMAIN$check_path" \ - && _INSTALL_APP "path=$check_path" \ - && _VALIDATE_THAT_APP_CAN_BE_ACCESSED $DOMAIN $check_path \ - && _VALIDATE_THAT_APP_CAN_BE_ACCESSED $SUBDOMAIN $check_path "" ${app_id}__2 \ + && log_small_title "Second installation: path=$DOMAIN$check_path" \ + && _INSTALL_APP "domain=$DOMAIN" "path=$check_path" \ + && _VALIDATE_THAT_APP_CAN_BE_ACCESSED $SUBDOMAIN $check_path \ + && _VALIDATE_THAT_APP_CAN_BE_ACCESSED $DOMAIN $check_path "" ${app_id}__2 \ && _REMOVE_APP \ - && _VALIDATE_THAT_APP_CAN_BE_ACCESSED $SUBDOMAIN $check_path "" ${app_id}__2 + && _VALIDATE_THAT_APP_CAN_BE_ACCESSED $DOMAIN $check_path "" ${app_id}__2 return $? } @@ -471,9 +472,8 @@ TEST_BACKUP_RESTORE () { # Place the copy of the backup archive in the container. sudo lxc file push -r ./ynh_backups/archives/* $LXC_NAME/home/yunohost.backup/archives/ - RUN_INSIDE_LXC ls -l /home/yunohost.backup/archives/ - log_small_title "Restore on a clean YunoHost system..." + log_small_title "Restore on a fresh YunoHost system..." fi # Restore the application from the previous backup diff --git a/lib/tests_coordination.sh b/lib/tests_coordination.sh index 942daa5..ff52d94 100644 --- a/lib/tests_coordination.sh +++ b/lib/tests_coordination.sh @@ -59,7 +59,7 @@ parse_check_process() { local commit for commit in $(cat $TEST_CONTEXT/check_process.upgrade_options | grep "^; commit=.*" | awk -F= '{print $2}') do - cat $TEST_CONTEXT/check_process.upgrade_options | sed -n -e "/^;; $commit/,/^;;/ p" | grep -v "^;;" > $TEST_CONTEXT/upgrades/$commit + cat $TEST_CONTEXT/check_process.upgrade_options | sed -n -e "/^; commit=$commit/,/^;/ p" | grep -v "^;;" > $TEST_CONTEXT/upgrades/$commit done rm $TEST_CONTEXT/check_process.upgrade_options @@ -108,10 +108,10 @@ parse_check_process() { # Upgrades with a specific commit if [[ "$test_type" == "TEST_UPGRADE" ]] && [[ -n "$test_arg" ]] then - local specific_upgrade_install_args="$(grep "^manifest_arg=" "$TEST_CONTEXT/upgrades/$commit" | cut -d'=' -f2-)" + local specific_upgrade_install_args="$(grep "^manifest_arg=" "$TEST_CONTEXT/upgrades/$test_arg" | cut -d'=' -f2-)" [[ -n "$specific_upgrade_install_args" ]] && _install_args="$specific_upgrade_install_args" - local upgrade_name="$(grep "^name=" "$TEST_CONTEXT/upgrades/$commit" | cut -d'=' -f2)" + local upgrade_name="$(grep "^name=" "$TEST_CONTEXT/upgrades/$test_arg" | cut -d'=' -f2)" extra="$(jq -n --arg upgrade_name "$upgrade_name" '{ $upgrade_name }')" elif [[ "$test_type" == "ACTIONS_CONFIG_PANEL" ]] && [[ "$test_arg" == "actions" ]] then @@ -139,13 +139,12 @@ parse_check_process() { is_test_enabled setup_root && add_test "TEST_INSTALL" "root" is_test_enabled setup_sub_dir && add_test "TEST_INSTALL" "subdir" is_test_enabled setup_nourl && add_test "TEST_INSTALL" "nourl" - grep "^upgrade=1" "$TEST_CONTEXT/check_process.tests_infos" | while IFS= read -r LINE; do commit="$(echo $LINE | grep -o "from_commit=.*" | awk -F= '{print $2}')" [ -n "$commit" ] || continue add_test "TEST_UPGRADE" "$commit" - done + done <<<$(grep "^upgrade=1" "$TEST_CONTEXT/check_process.tests_infos") continue else @@ -161,12 +160,11 @@ parse_check_process() { is_test_enabled backup_restore && add_test "TEST_BACKUP_RESTORE" # Upgrades - grep "^upgrade=1" "$TEST_CONTEXT/check_process.tests_infos" | while IFS= read -r LINE; do commit="$(echo $LINE | grep -o "from_commit=.*" | awk -F= '{print $2}')" add_test "TEST_UPGRADE" "$commit" - done + done <<<$(grep "^upgrade=1" "$TEST_CONTEXT/check_process.tests_infos") # "Advanced" features