mirror of
https://github.com/YunoHost/package_check.git
synced 2024-09-03 20:06:20 +02:00
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:
parent
fe56eb2de7
commit
f514824235
2 changed files with 14 additions and 10 deletions
10
lib/tests.sh
10
lib/tests.sh
|
@ -382,10 +382,14 @@ TEST_INSTALL () {
|
||||||
|
|
||||||
_PREINSTALL
|
_PREINSTALL
|
||||||
|
|
||||||
|
metrics_start
|
||||||
|
|
||||||
# Install the application in a LXC container
|
# Install the application in a LXC container
|
||||||
_INSTALL_APP "path=$check_path" "is_public=$is_public" "init_main_permission=$init_main_permission" \
|
_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" \
|
&& _VALIDATE_THAT_APP_CAN_BE_ACCESSED "$SUBDOMAIN" "$check_path" "$install_type" \
|
||||||
|
|
||||||
|
metrics_stop
|
||||||
|
|
||||||
local install=$?
|
local install=$?
|
||||||
|
|
||||||
[ $install -eq 0 ] || return 1
|
[ $install -eq 0 ] || return 1
|
||||||
|
@ -488,10 +492,14 @@ TEST_UPGRADE () {
|
||||||
ret=$?
|
ret=$?
|
||||||
[ $ret -eq 0 ] || { log_error "Pre-upgrade instruction failed"; return 1; }
|
[ $ret -eq 0 ] || { log_error "Pre-upgrade instruction failed"; return 1; }
|
||||||
|
|
||||||
|
metrics_start
|
||||||
|
|
||||||
# Upgrade the application in a LXC container
|
# Upgrade the application in a LXC container
|
||||||
_RUN_YUNOHOST_CMD "app upgrade $app_id --file /app_folder --force" \
|
_RUN_YUNOHOST_CMD "app upgrade $app_id --file /app_folder --force" \
|
||||||
&& _VALIDATE_THAT_APP_CAN_BE_ACCESSED "$SUBDOMAIN" "$check_path" "upgrade"
|
&& _VALIDATE_THAT_APP_CAN_BE_ACCESSED "$SUBDOMAIN" "$check_path" "upgrade"
|
||||||
|
|
||||||
|
metrics_stop
|
||||||
|
|
||||||
return $?
|
return $?
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -608,8 +616,10 @@ TEST_BACKUP_RESTORE () {
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Restore the application from the previous backup
|
# Restore the application from the previous backup
|
||||||
|
metrics_start
|
||||||
_RUN_YUNOHOST_CMD "backup restore Backup_test --force --apps $app_id" \
|
_RUN_YUNOHOST_CMD "backup restore Backup_test --force --apps $app_id" \
|
||||||
&& _VALIDATE_THAT_APP_CAN_BE_ACCESSED "$SUBDOMAIN" "$check_path"
|
&& _VALIDATE_THAT_APP_CAN_BE_ACCESSED "$SUBDOMAIN" "$check_path"
|
||||||
|
metrics_stop
|
||||||
|
|
||||||
ret=$?
|
ret=$?
|
||||||
[ $ret -eq 0 ] || main_result=1
|
[ $ret -eq 0 ] || main_result=1
|
||||||
|
|
|
@ -111,9 +111,6 @@ TEST_LAUNCHER () {
|
||||||
# And keep this value separately
|
# And keep this value separately
|
||||||
local global_start_timer=$starttime
|
local global_start_timer=$starttime
|
||||||
|
|
||||||
# Start metrics measurement
|
|
||||||
metrics_start
|
|
||||||
|
|
||||||
current_test_id=$(basename $testfile | cut -d. -f1)
|
current_test_id=$(basename $testfile | cut -d. -f1)
|
||||||
current_test_infos="$TEST_CONTEXT/tests/$current_test_id.json"
|
current_test_infos="$TEST_CONTEXT/tests/$current_test_id.json"
|
||||||
current_test_results="$TEST_CONTEXT/results/$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
|
# End the timer for the test
|
||||||
stop_timer one_test
|
stop_timer one_test
|
||||||
|
|
||||||
# Stop metrics and show results
|
|
||||||
metrics_stop
|
|
||||||
|
|
||||||
LXC_STOP $LXC_NAME
|
LXC_STOP $LXC_NAME
|
||||||
|
|
||||||
# Update the lock file with the date of the last finished test.
|
# Update the lock file with the date of the last finished test.
|
||||||
|
|
Loading…
Add table
Reference in a new issue