metrics: move the metric start/stop around the install/upgrade/restore command, because we want to avoid being polluted by snapshot create/restore ...

This commit is contained in:
Alexandre Aubin 2023-02-21 17:01:21 +01:00
parent fe56eb2de7
commit f514824235
2 changed files with 14 additions and 10 deletions

View file

@ -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

View file

@ -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.