diff --git a/lib/tests.sh b/lib/tests.sh index 24f34a3..4094f8d 100644 --- a/lib/tests.sh +++ b/lib/tests.sh @@ -94,7 +94,7 @@ _INSTALL_APP () { # because this also applies to upgrades ... ie older version may have different args and default values # Fetch and loop over all manifest arg - if [[ -e $package_path/manifest.json ]] + if [[ -e $package_path/manifest.json ]] then local manifest_args="$(jq -r '.arguments.install[].name' $package_path/manifest.json)" else @@ -106,7 +106,7 @@ _INSTALL_APP () { # If the argument is not yet in install args, add its default value if ! echo "$install_args" | grep -q -E "\<$ARG=" then - if [[ -e $package_path/manifest.json ]] + if [[ -e $package_path/manifest.json ]] then local default_value=$(jq -e -r --arg ARG $ARG '.arguments.install[] | select(.name==$ARG) | .default' $package_path/manifest.json) else @@ -197,7 +197,7 @@ _VALIDATE_THAT_APP_CAN_BE_ACCESSED () { else local has_public_arg=$(grep -q '\[install.init_main_permission\]' $package_path/manifest.toml && echo true || echo false) fi - + if [ "$install_type" != 'private' ] && [[ $has_public_arg == "false" ]] then log_debug "Forcing public access using a skipped_uris setting" @@ -243,7 +243,7 @@ _VALIDATE_THAT_APP_CAN_BE_ACCESSED () { --output './curl_output' \ $check_domain$curl_check_path" \ > "$TEST_CONTEXT/curl_print" - + LXC_EXEC "cat ./curl_output" > $curl_output # Analyze the result of curl command @@ -382,10 +382,14 @@ TEST_INSTALL () { _PREINSTALL + metrics_start + # Install the application in a LXC container _INSTALL_APP "path=$check_path" "is_public=$is_public" "init_main_permission=$init_main_permission" \ && _VALIDATE_THAT_APP_CAN_BE_ACCESSED "$SUBDOMAIN" "$check_path" "$install_type" \ + metrics_stop + local install=$? [ $install -eq 0 ] || return 1 @@ -488,10 +492,14 @@ TEST_UPGRADE () { ret=$? [ $ret -eq 0 ] || { log_error "Pre-upgrade instruction failed"; return 1; } + metrics_start + # Upgrade the application in a LXC container _RUN_YUNOHOST_CMD "app upgrade $app_id --file /app_folder --force" \ && _VALIDATE_THAT_APP_CAN_BE_ACCESSED "$SUBDOMAIN" "$check_path" "upgrade" + metrics_stop + return $? } @@ -608,8 +616,10 @@ TEST_BACKUP_RESTORE () { fi # Restore the application from the previous backup + metrics_start _RUN_YUNOHOST_CMD "backup restore Backup_test --force --apps $app_id" \ && _VALIDATE_THAT_APP_CAN_BE_ACCESSED "$SUBDOMAIN" "$check_path" + metrics_stop ret=$? [ $ret -eq 0 ] || main_result=1 diff --git a/lib/tests_coordination.sh b/lib/tests_coordination.sh index c29b766..fa80e32 100644 --- a/lib/tests_coordination.sh +++ b/lib/tests_coordination.sh @@ -111,9 +111,6 @@ TEST_LAUNCHER () { # And keep this value separately local global_start_timer=$starttime - # Start metrics measurement - metrics_start - current_test_id=$(basename $testfile | cut -d. -f1) current_test_infos="$TEST_CONTEXT/tests/$current_test_id.json" current_test_results="$TEST_CONTEXT/results/$current_test_id.json" @@ -171,9 +168,6 @@ TEST_LAUNCHER () { # End the timer for the test stop_timer one_test - # Stop metrics and show results - metrics_stop - LXC_STOP $LXC_NAME # Update the lock file with the date of the last finished test.