mirror of
https://github.com/YunoHost/package_check.git
synced 2024-09-03 20:06:20 +02:00
backup/restore for both root and subdir
This commit is contained in:
parent
a45b22132c
commit
a4c0a3fcc4
2 changed files with 82 additions and 66 deletions
20
lib/tests.sh
20
lib/tests.sh
|
@ -452,15 +452,24 @@ TEST_BACKUP_RESTORE () {
|
|||
# Check if an install have previously work
|
||||
at_least_one_install_succeeded || return 1
|
||||
|
||||
local check_path="$(default_install_path)"
|
||||
local check_paths=()
|
||||
|
||||
if this_is_a_web_app; then
|
||||
there_is_a_root_install_test && check_paths+=("$(root_path)")
|
||||
there_is_a_subdir_install_test && check_paths+=("$(subdir_path)")
|
||||
else
|
||||
check_paths+=("")
|
||||
fi
|
||||
|
||||
local main_result=0
|
||||
|
||||
for check_path in "${check_paths[@]}"
|
||||
do
|
||||
# Install the application in a LXC container
|
||||
_LOAD_SNAPSHOT_OR_INSTALL_APP "$check_path"
|
||||
|
||||
local ret=$?
|
||||
|
||||
local main_result=0
|
||||
|
||||
# Remove the previous residual backups
|
||||
RUN_INSIDE_LXC rm -rf /home/yunohost.backup/archives
|
||||
|
||||
|
@ -469,6 +478,8 @@ TEST_BACKUP_RESTORE () {
|
|||
if [ $ret -ne 0 ]
|
||||
then
|
||||
log_error "Installation failed..."
|
||||
main_result=1
|
||||
continue
|
||||
else
|
||||
log_small_title "Backup of the application..."
|
||||
|
||||
|
@ -516,11 +527,12 @@ TEST_BACKUP_RESTORE () {
|
|||
_RUN_YUNOHOST_CMD "backup restore Backup_test --force --apps $app_id" \
|
||||
&& _VALIDATE_THAT_APP_CAN_BE_ACCESSED "$SUBDOMAIN" "$check_path"
|
||||
|
||||
local ret=$?
|
||||
ret=$?
|
||||
[ $ret -eq 0 ] || main_result=1
|
||||
|
||||
break_before_continue
|
||||
done
|
||||
done
|
||||
|
||||
return $main_result
|
||||
}
|
||||
|
|
|
@ -403,15 +403,19 @@ this_is_a_web_app () {
|
|||
return $(there_is_a_root_install_test) || $(there_is_a_subdir_install_test)
|
||||
}
|
||||
|
||||
root_path () {
|
||||
echo "/"
|
||||
}
|
||||
|
||||
subdir_path () {
|
||||
echo "/path"
|
||||
}
|
||||
|
||||
default_install_path() {
|
||||
# All webapps should be installable at the root or in a subpath of a domain
|
||||
if there_is_a_root_install_test; then
|
||||
echo "/"
|
||||
elif there_is_a_subdir_install_test; then
|
||||
echo "/path"
|
||||
else
|
||||
there_is_a_root_install_test && { root_path; return; }
|
||||
there_is_a_subdir_install_test && { subdir_path; return; }
|
||||
echo ""
|
||||
fi
|
||||
}
|
||||
|
||||
path_to_install_type() {
|
||||
|
|
Loading…
Add table
Reference in a new issue