mirror of
https://github.com/YunoHost/package_check.git
synced 2024-09-03 20:06:20 +02:00
Add change_url new test
This commit is contained in:
parent
44f9e95348
commit
e1ed044b00
6 changed files with 185 additions and 19 deletions
|
@ -23,6 +23,7 @@ Le script est capable d'effectuer les tests suivant:
|
||||||
- Installation multi-instance
|
- Installation multi-instance
|
||||||
- Test de path mal formé (path/ au lieu de /path)
|
- Test de path mal formé (path/ au lieu de /path)
|
||||||
- Test de port déjà utilisé
|
- Test de port déjà utilisé
|
||||||
|
- Test du script change_url
|
||||||
|
|
||||||
Package check utilise un conteneur LXC pour créer un environnement de test propre sans résidus d'installations précédentes.
|
Package check utilise un conteneur LXC pour créer un environnement de test propre sans résidus d'installations précédentes.
|
||||||
|
|
||||||
|
@ -69,6 +70,7 @@ package_check/package_check.sh APP_ynh
|
||||||
multi_instance=1
|
multi_instance=1
|
||||||
incorrect_path=1
|
incorrect_path=1
|
||||||
port_already_use=1 (XXXX)
|
port_already_use=1 (XXXX)
|
||||||
|
change_url=1
|
||||||
;;; Levels
|
;;; Levels
|
||||||
Level 1=auto
|
Level 1=auto
|
||||||
Level 2=auto
|
Level 2=auto
|
||||||
|
@ -114,6 +116,7 @@ Si un test est absent de la liste, il sera ignoré. Cela revient à le noter à
|
||||||
- `port_already_use`: Provoque une erreur sur le port en l'ouvrant avant le script d'install.
|
- `port_already_use`: Provoque une erreur sur le port en l'ouvrant avant le script d'install.
|
||||||
Le test` port_already_use` peut éventuellement prendre en argument un numéro de port. Si celui-ci n'est pas dans le manifest.
|
Le test` port_already_use` peut éventuellement prendre en argument un numéro de port. Si celui-ci n'est pas dans le manifest.
|
||||||
Le numéro de port doit alors être noté entre parenthèse, il servira au test de port.
|
Le numéro de port doit alors être noté entre parenthèse, il servira au test de port.
|
||||||
|
- `change_url`: Test le script change_url de 6 manières différentes, Root vers un path, path vers un autre path et path vers root. Et la même chose avec un autre domaine.
|
||||||
|
|
||||||
### `;;; Levels`
|
### `;;; Levels`
|
||||||
Permet de choisir comment [chaque niveau](https://yunohost.org/#/packaging_apps_levels_fr) est déterminé.
|
Permet de choisir comment [chaque niveau](https://yunohost.org/#/packaging_apps_levels_fr) est déterminé.
|
||||||
|
|
|
@ -23,6 +23,7 @@ The script is able to perform following tests:
|
||||||
- Multi-instances installation
|
- Multi-instances installation
|
||||||
- Test malformed path (path/ instead od /path)
|
- Test malformed path (path/ instead od /path)
|
||||||
- Test port already use
|
- Test port already use
|
||||||
|
- Test of change_url script
|
||||||
|
|
||||||
Package_check script use an LXC container to manipulate the package in a non parasited environnement by previous installs.
|
Package_check script use an LXC container to manipulate the package in a non parasited environnement by previous installs.
|
||||||
|
|
||||||
|
@ -69,6 +70,7 @@ package_check/package_check.sh APP_ynh
|
||||||
multi_instance=1
|
multi_instance=1
|
||||||
incorrect_path=1
|
incorrect_path=1
|
||||||
port_already_use=1 (XXXX)
|
port_already_use=1 (XXXX)
|
||||||
|
change_url=1
|
||||||
;;; Levels
|
;;; Levels
|
||||||
Level 1=auto
|
Level 1=auto
|
||||||
Level 2=auto
|
Level 2=auto
|
||||||
|
@ -114,6 +116,7 @@ If a test is not in the list, it will be ignored. It's similar to marked at 0.
|
||||||
- `port_already_use`: Causes an error on the port by opening before.
|
- `port_already_use`: Causes an error on the port by opening before.
|
||||||
The `port_already_use` test may eventually take in argument the port number.
|
The `port_already_use` test may eventually take in argument the port number.
|
||||||
The port number must be written into parentheses, it will serve to test port.
|
The port number must be written into parentheses, it will serve to test port.
|
||||||
|
- `change_url`: Try to change the url by 6 different way. Root to path, path to another path and path to root. And the same thing, with another domain.
|
||||||
|
|
||||||
### `;;; Levels`
|
### `;;; Levels`
|
||||||
Allow to choose how [each level](https://yunohost.org/#/packaging_apps_levels_fr) is determined
|
Allow to choose how [each level](https://yunohost.org/#/packaging_apps_levels_fr) is determined
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
multi_instance=1
|
multi_instance=1
|
||||||
incorrect_path=1
|
incorrect_path=1
|
||||||
port_already_use=1 (66)
|
port_already_use=1 (66)
|
||||||
|
change_url=0
|
||||||
;;; Levels
|
;;; Levels
|
||||||
Level 1=auto
|
Level 1=auto
|
||||||
Level 2=auto
|
Level 2=auto
|
||||||
|
|
|
@ -512,6 +512,7 @@ TEST_RESULTS () {
|
||||||
print_result "Port already used" $RESULT_check_port
|
print_result "Port already used" $RESULT_check_port
|
||||||
print_result "Backup" $RESULT_check_backup
|
print_result "Backup" $RESULT_check_backup
|
||||||
print_result "Restore" $RESULT_check_restore
|
print_result "Restore" $RESULT_check_restore
|
||||||
|
print_result "Change URL" $RESULT_change_url
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -646,7 +647,8 @@ TEST_RESULTS () {
|
||||||
[ $RESULT_check_path -ne -1 ] && \
|
[ $RESULT_check_path -ne -1 ] && \
|
||||||
[ $RESULT_check_port -ne -1 ] && \
|
[ $RESULT_check_port -ne -1 ] && \
|
||||||
[ $RESULT_check_backup -ne -1 ] && \
|
[ $RESULT_check_backup -ne -1 ] && \
|
||||||
[ $RESULT_check_restore -ne -1 ]
|
[ $RESULT_check_restore -ne -1 ] && \
|
||||||
|
[ $RESULT_change_url -ne -1 ]
|
||||||
then level[7]=2
|
then level[7]=2
|
||||||
else level[7]=0
|
else level[7]=0
|
||||||
fi
|
fi
|
||||||
|
@ -755,6 +757,7 @@ initialize_values() {
|
||||||
RESULT_check_multi_instance=0
|
RESULT_check_multi_instance=0
|
||||||
RESULT_check_path=0
|
RESULT_check_path=0
|
||||||
RESULT_check_port=0
|
RESULT_check_port=0
|
||||||
|
RESULT_change_url=0
|
||||||
|
|
||||||
# auto_remove parameter
|
# auto_remove parameter
|
||||||
if [ $interrupt -eq 1 ]; then
|
if [ $interrupt -eq 1 ]; then
|
||||||
|
@ -980,6 +983,8 @@ fi
|
||||||
count_test $incorrect_path
|
count_test $incorrect_path
|
||||||
port_already_use=$(read_check_option port_already_use)
|
port_already_use=$(read_check_option port_already_use)
|
||||||
count_test $port_already_use
|
count_test $port_already_use
|
||||||
|
change_url=$(read_check_option change_url)
|
||||||
|
count_test $change_url
|
||||||
|
|
||||||
# For port_already_use, check if there is also a port number
|
# For port_already_use, check if there is also a port number
|
||||||
if [ $port_already_use -eq 1 ]
|
if [ $port_already_use -eq 1 ]
|
||||||
|
@ -1022,6 +1027,7 @@ else
|
||||||
multi_instance=1
|
multi_instance=1
|
||||||
incorrect_path=1
|
incorrect_path=1
|
||||||
port_already_use=0
|
port_already_use=0
|
||||||
|
change_url=0
|
||||||
all_test=$((all_test+9))
|
all_test=$((all_test+9))
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -165,15 +165,14 @@ ssh $ARG_SSH $LXC_NAME "cd /tmp/install_script; sudo ./install_yunohost -a" | te
|
||||||
echo -e "\e[1m> Post install Yunohost\e[0m" | tee -a "$LOG_BUILD_LXC"
|
echo -e "\e[1m> Post install Yunohost\e[0m" | tee -a "$LOG_BUILD_LXC"
|
||||||
ssh $ARG_SSH $LXC_NAME "sudo yunohost tools postinstall --domain $DOMAIN --password $YUNO_PWD" | tee -a "$LOG_BUILD_LXC" 2>&1
|
ssh $ARG_SSH $LXC_NAME "sudo yunohost tools postinstall --domain $DOMAIN --password $YUNO_PWD" | tee -a "$LOG_BUILD_LXC" 2>&1
|
||||||
|
|
||||||
USER_TEST=$(cat "$(dirname "$script_dir")/package_check.sh" | grep USER_TEST= | cut -d '=' -f2)
|
USER_TEST=$(cat "$(dirname "$script_dir")/package_check.sh" | grep test_user= | cut -d '=' -f2)
|
||||||
PASSWORD_TEST=$(cat "$(dirname "$script_dir")/package_check.sh" | grep PASSWORD_TEST= | cut -d '=' -f2)
|
|
||||||
SOUS_DOMAIN="sous.$DOMAIN"
|
SOUS_DOMAIN="sous.$DOMAIN"
|
||||||
# echo "Le mot de passe Yunohost est \'$YUNO_PWD\'"
|
# echo "Le mot de passe Yunohost est \'$YUNO_PWD\'"
|
||||||
echo -e "\e[1m> Ajout du sous domaine de test\e[0m" | tee -a "$LOG_BUILD_LXC"
|
echo -e "\e[1m> Ajout du sous domaine de test\e[0m" | tee -a "$LOG_BUILD_LXC"
|
||||||
ssh $ARG_SSH $LXC_NAME "sudo yunohost domain add \"$SOUS_DOMAIN\" --admin-password=\"$YUNO_PWD\""
|
ssh $ARG_SSH $LXC_NAME "sudo yunohost domain add \"$SOUS_DOMAIN\" --admin-password=\"$YUNO_PWD\""
|
||||||
USER_TEST_CLEAN=${USER_TEST//"_"/""}
|
USER_TEST_CLEAN=${USER_TEST//"_"/""}
|
||||||
echo -e "\e[1m> Ajout de l'utilisateur de test\e[0m" | tee -a "$LOG_BUILD_LXC"
|
echo -e "\e[1m> Ajout de l'utilisateur de test\e[0m" | tee -a "$LOG_BUILD_LXC"
|
||||||
ssh $ARG_SSH $LXC_NAME "sudo yunohost user create --firstname \"$USER_TEST_CLEAN\" --mail \"$USER_TEST_CLEAN@$DOMAIN\" --lastname \"$USER_TEST_CLEAN\" --password \"$PASSWORD_TEST\" \"$USER_TEST\" --admin-password=\"$YUNO_PWD\""
|
ssh $ARG_SSH $LXC_NAME "sudo yunohost user create --firstname \"$USER_TEST_CLEAN\" --mail \"$USER_TEST_CLEAN@$DOMAIN\" --lastname \"$USER_TEST_CLEAN\" --password \"$YUNO_PWD\" \"$USER_TEST\" --admin-password=\"$YUNO_PWD\""
|
||||||
|
|
||||||
echo -e -e "\e[1m\n> Vérification de l'état de Yunohost\e[0m" | tee -a "$LOG_BUILD_LXC"
|
echo -e -e "\e[1m\n> Vérification de l'état de Yunohost\e[0m" | tee -a "$LOG_BUILD_LXC"
|
||||||
ssh $ARG_SSH $LXC_NAME "sudo yunohost -v" | tee -a "$LOG_BUILD_LXC" 2>&1
|
ssh $ARG_SSH $LXC_NAME "sudo yunohost -v" | tee -a "$LOG_BUILD_LXC" 2>&1
|
||||||
|
|
|
@ -96,12 +96,12 @@ CHECK_URL () {
|
||||||
|
|
||||||
# Inform /etc/hosts with the IP of LXC to resolve the domain.
|
# Inform /etc/hosts with the IP of LXC to resolve the domain.
|
||||||
# This is set only here and not before to prevent to help the app's scripts
|
# This is set only here and not before to prevent to help the app's scripts
|
||||||
echo -e "$ip_range.2 $main_domain #package_check\n$ip_range.2 $sub_domain #package_check" | sudo tee --append /etc/hosts > /dev/null
|
echo -e "$ip_range.2 $check_domain #package_check" | sudo tee --append /etc/hosts > /dev/null
|
||||||
|
|
||||||
# Try to resolv the domain during 10 seconds maximum.
|
# Try to resolv the domain during 10 seconds maximum.
|
||||||
local i=0
|
local i=0
|
||||||
for i in `seq 1 10`; do
|
for i in `seq 1 10`; do
|
||||||
curl --location --insecure $sub_domain > /dev/null 2>&1
|
curl --location --insecure $check_domain > /dev/null 2>&1
|
||||||
# If curl return 6, it's an error "Could not resolve host"
|
# If curl return 6, it's an error "Could not resolve host"
|
||||||
if [ $? -ne 6 ]; then
|
if [ $? -ne 6 ]; then
|
||||||
# If not, curl is ready to work.
|
# If not, curl is ready to work.
|
||||||
|
@ -157,7 +157,7 @@ CHECK_URL () {
|
||||||
rm -f "$script_dir/url_output"
|
rm -f "$script_dir/url_output"
|
||||||
|
|
||||||
# Call curl to try to access to the url of the app
|
# Call curl to try to access to the url of the app
|
||||||
curl --location --insecure --silent --show-error --write-out "%{http_code};%{url_effective}\n" $sub_domain$curl_check_path --output "$script_dir/url_output" > "$script_dir/curl_print"
|
curl --location --insecure --silent --show-error --write-out "%{http_code};%{url_effective}\n" $check_domain$curl_check_path --output "$script_dir/url_output" > "$script_dir/curl_print"
|
||||||
|
|
||||||
# Analyze the result of curl command
|
# Analyze the result of curl command
|
||||||
if [ $? -ne 0 ]
|
if [ $? -ne 0 ]
|
||||||
|
@ -167,7 +167,7 @@ CHECK_URL () {
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Print informations about the connection
|
# Print informations about the connection
|
||||||
ECHO_FORMAT "Test url: $sub_domain$curl_check_path\n" "white"
|
ECHO_FORMAT "Test url: $check_domain$curl_check_path\n" "white"
|
||||||
ECHO_FORMAT "Real url: $(cat "$script_dir/curl_print" | cut --delimiter=';' --fields=2)\n" "white"
|
ECHO_FORMAT "Real url: $(cat "$script_dir/curl_print" | cut --delimiter=';' --fields=2)\n" "white"
|
||||||
local http_code=$(cat "$script_dir/curl_print" | cut -d ';' -f1)
|
local http_code=$(cat "$script_dir/curl_print" | cut -d ';' -f1)
|
||||||
ECHO_FORMAT "HTTP code: $http_code\n" "white"
|
ECHO_FORMAT "HTTP code: $http_code\n" "white"
|
||||||
|
@ -327,7 +327,7 @@ is_install_failed () {
|
||||||
then
|
then
|
||||||
# If root installation worked, return root.
|
# If root installation worked, return root.
|
||||||
echo root
|
echo root
|
||||||
elif [ $RESULT_check_sub_dir -eq 1 ] || [ $force_install_ok -eq 1 ]
|
elif [ $RESULT_check_sub_dir -eq 1 ] && [ $force_install_ok -ne 1 ]
|
||||||
then
|
then
|
||||||
# If subdir installation worked or force_install_ok setted, return subdir.
|
# If subdir installation worked or force_install_ok setted, return subdir.
|
||||||
echo subdir
|
echo subdir
|
||||||
|
@ -366,7 +366,8 @@ CHECK_SETUP () {
|
||||||
local manifest_args_mod="$manifest_arguments"
|
local manifest_args_mod="$manifest_arguments"
|
||||||
|
|
||||||
# Replace manifest key for the test
|
# Replace manifest key for the test
|
||||||
replace_manifest_key "domain" "$sub_domain"
|
check_domain=$sub_domain
|
||||||
|
replace_manifest_key "domain" "$check_domain"
|
||||||
if [ "$install_type" = "subdir" ]; then
|
if [ "$install_type" = "subdir" ]; then
|
||||||
local check_path=$test_path
|
local check_path=$test_path
|
||||||
elif [ "$install_type" = "root" ]; then
|
elif [ "$install_type" = "root" ]; then
|
||||||
|
@ -442,7 +443,8 @@ CHECK_UPGRADE () {
|
||||||
local manifest_args_mod="$manifest_arguments"
|
local manifest_args_mod="$manifest_arguments"
|
||||||
|
|
||||||
# Replace manifest key for the test
|
# Replace manifest key for the test
|
||||||
replace_manifest_key "domain" "$sub_domain"
|
check_domain=$sub_domain
|
||||||
|
replace_manifest_key "domain" "$check_domain"
|
||||||
# Use a path according to previous succeeded installs
|
# Use a path according to previous succeeded installs
|
||||||
if [ "$previous_install" = "subdir" ]; then
|
if [ "$previous_install" = "subdir" ]; then
|
||||||
local check_path=$test_path
|
local check_path=$test_path
|
||||||
|
@ -527,7 +529,8 @@ CHECK_PUBLIC_PRIVATE () {
|
||||||
local manifest_args_mod="$manifest_arguments"
|
local manifest_args_mod="$manifest_arguments"
|
||||||
|
|
||||||
# Replace manifest key for the test
|
# Replace manifest key for the test
|
||||||
replace_manifest_key "domain" "$sub_domain"
|
check_domain=$sub_domain
|
||||||
|
replace_manifest_key "domain" "$check_domain"
|
||||||
replace_manifest_key "user" "$test_user"
|
replace_manifest_key "user" "$test_user"
|
||||||
# Set public or private according to type of test requested
|
# Set public or private according to type of test requested
|
||||||
if [ "$install_type" = "private" ]; then
|
if [ "$install_type" = "private" ]; then
|
||||||
|
@ -547,7 +550,7 @@ CHECK_PUBLIC_PRIVATE () {
|
||||||
if [ $i -eq 0 ]
|
if [ $i -eq 0 ]
|
||||||
then
|
then
|
||||||
# Check if root installation worked, or if force_install_ok is setted.
|
# Check if root installation worked, or if force_install_ok is setted.
|
||||||
if [ $RESULT_check_root -eq 1 ] || [ $force_install_ok -eq 1 ]
|
if [ $RESULT_check_root -eq 1 ] && [ $force_install_ok -ne 1 ]
|
||||||
then
|
then
|
||||||
# Replace manifest key for path
|
# Replace manifest key for path
|
||||||
local check_path=/
|
local check_path=/
|
||||||
|
@ -562,7 +565,7 @@ CHECK_PUBLIC_PRIVATE () {
|
||||||
elif [ $i -eq 1 ]
|
elif [ $i -eq 1 ]
|
||||||
then
|
then
|
||||||
# Check if sub path installation worked, or if force_install_ok is setted.
|
# Check if sub path installation worked, or if force_install_ok is setted.
|
||||||
if [ $RESULT_check_sub_dir -eq 1 ] || [ $force_install_ok -eq 1 ]
|
if [ $RESULT_check_sub_dir -eq 1 ] && [ $force_install_ok -ne 1 ]
|
||||||
then
|
then
|
||||||
# Replace manifest key for path
|
# Replace manifest key for path
|
||||||
local check_path=$test_path
|
local check_path=$test_path
|
||||||
|
@ -644,7 +647,8 @@ CHECK_MULTI_INSTANCE () {
|
||||||
local manifest_args_mod="$manifest_arguments"
|
local manifest_args_mod="$manifest_arguments"
|
||||||
|
|
||||||
# Replace manifest key for the test
|
# Replace manifest key for the test
|
||||||
replace_manifest_key "domain" "$sub_domain"
|
check_domain=$sub_domain
|
||||||
|
replace_manifest_key "domain" "$check_domain"
|
||||||
replace_manifest_key "user" "$test_user"
|
replace_manifest_key "user" "$test_user"
|
||||||
replace_manifest_key "public" "$public_public_arg"
|
replace_manifest_key "public" "$public_public_arg"
|
||||||
|
|
||||||
|
@ -772,7 +776,8 @@ CHECK_COMMON_ERROR () {
|
||||||
local manifest_args_mod="$manifest_arguments"
|
local manifest_args_mod="$manifest_arguments"
|
||||||
|
|
||||||
# Replace manifest key for the test
|
# Replace manifest key for the test
|
||||||
replace_manifest_key "domain" "$sub_domain"
|
check_domain=$sub_domain
|
||||||
|
replace_manifest_key "domain" "$check_domain"
|
||||||
replace_manifest_key "user" "$test_user"
|
replace_manifest_key "user" "$test_user"
|
||||||
replace_manifest_key "public" "$public_public_arg"
|
replace_manifest_key "public" "$public_public_arg"
|
||||||
|
|
||||||
|
@ -857,7 +862,8 @@ CHECK_BACKUP_RESTORE () {
|
||||||
local manifest_args_mod="$manifest_arguments"
|
local manifest_args_mod="$manifest_arguments"
|
||||||
|
|
||||||
# Replace manifest key for the test
|
# Replace manifest key for the test
|
||||||
replace_manifest_key "domain" "$sub_domain"
|
check_domain=$sub_domain
|
||||||
|
replace_manifest_key "domain" "$check_domain"
|
||||||
replace_manifest_key "user" "$test_user"
|
replace_manifest_key "user" "$test_user"
|
||||||
replace_manifest_key "public" "$public_public_arg"
|
replace_manifest_key "public" "$public_public_arg"
|
||||||
|
|
||||||
|
@ -869,7 +875,7 @@ CHECK_BACKUP_RESTORE () {
|
||||||
if [ $i -eq 0 ]
|
if [ $i -eq 0 ]
|
||||||
then
|
then
|
||||||
# Check if root installation worked, or if force_install_ok is setted.
|
# Check if root installation worked, or if force_install_ok is setted.
|
||||||
if [ $RESULT_check_root -eq 1 ] || [ $force_install_ok -eq 1 ]
|
if [ $RESULT_check_root -eq 1 ] && [ $force_install_ok -ne 1 ]
|
||||||
then
|
then
|
||||||
# Replace manifest key for path
|
# Replace manifest key for path
|
||||||
local check_path=/
|
local check_path=/
|
||||||
|
@ -885,7 +891,7 @@ CHECK_BACKUP_RESTORE () {
|
||||||
elif [ $i -eq 1 ]
|
elif [ $i -eq 1 ]
|
||||||
then
|
then
|
||||||
# Check if sub path installation worked, or if force_install_ok is setted.
|
# Check if sub path installation worked, or if force_install_ok is setted.
|
||||||
if [ $RESULT_check_sub_dir -eq 1 ] || [ $force_install_ok -eq 1 ]
|
if [ $RESULT_check_sub_dir -eq 1 ] && [ $force_install_ok -ne 1 ]
|
||||||
then
|
then
|
||||||
# Replace manifest key for path
|
# Replace manifest key for path
|
||||||
local check_path=$test_path
|
local check_path=$test_path
|
||||||
|
@ -1015,6 +1021,149 @@ CHECK_BACKUP_RESTORE () {
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CHECK_CHANGE_URL () {
|
||||||
|
# Try the change_url script
|
||||||
|
|
||||||
|
unit_test_title "Change URL..."
|
||||||
|
|
||||||
|
# Check if the needed manifest key are set or abort the test
|
||||||
|
check_manifest_key "domain" || return
|
||||||
|
|
||||||
|
# Check if an install have previously work
|
||||||
|
local previous_install=$(is_install_failed)
|
||||||
|
# Abort if none install worked
|
||||||
|
[ "$previous_install" = "1" ] && return
|
||||||
|
|
||||||
|
# Copy original arguments
|
||||||
|
local manifest_args_mod="$manifest_arguments"
|
||||||
|
|
||||||
|
# Replace manifest key for the test
|
||||||
|
check_domain=$sub_domain
|
||||||
|
replace_manifest_key "domain" "$check_domain"
|
||||||
|
replace_manifest_key "user" "$test_user"
|
||||||
|
replace_manifest_key "public" "$public_public_arg"
|
||||||
|
|
||||||
|
# Try in 6 times !
|
||||||
|
# Without modify the domain, root to path, path to path and path to root.
|
||||||
|
# And then, same with a domain change
|
||||||
|
local i=0
|
||||||
|
for i in ` seq 1 6`
|
||||||
|
do
|
||||||
|
if [ $i -eq 1 ]; then
|
||||||
|
# Same domain, root to path
|
||||||
|
check_path=/
|
||||||
|
local new_path=$test_path
|
||||||
|
local new_domain=$sub_domain
|
||||||
|
elif [ $i -eq 2 ]; then
|
||||||
|
# Same domain, path to path
|
||||||
|
check_path=$test_path
|
||||||
|
local new_path=${test_path}_2
|
||||||
|
local new_domain=$sub_domain
|
||||||
|
elif [ $i -eq 3 ]; then
|
||||||
|
# Same domain, path to root
|
||||||
|
check_path=$test_path
|
||||||
|
local new_path=/
|
||||||
|
local new_domain=$sub_domain
|
||||||
|
|
||||||
|
elif [ $i -eq 4 ]; then
|
||||||
|
# Other domain, root to path
|
||||||
|
check_path=/
|
||||||
|
local new_path=$test_path
|
||||||
|
local new_domain=$main_domain
|
||||||
|
elif [ $i -eq 5 ]; then
|
||||||
|
# Other domain, path to path
|
||||||
|
check_path=$test_path
|
||||||
|
local new_path=${test_path}_2
|
||||||
|
local new_domain=$main_domain
|
||||||
|
elif [ $i -eq 6 ]; then
|
||||||
|
# Other domain, path to root
|
||||||
|
check_path=$test_path
|
||||||
|
local new_path=/
|
||||||
|
local new_domain=$main_domain
|
||||||
|
fi
|
||||||
|
replace_manifest_key "path" "$check_path"
|
||||||
|
|
||||||
|
# Check if root or subpath installation worked, or if force_install_ok is setted.
|
||||||
|
if [ $force_install_ok -eq 1 ]
|
||||||
|
then
|
||||||
|
# Try with a sub path install
|
||||||
|
if [ "$check_path" = "/" ]
|
||||||
|
then
|
||||||
|
if [ $RESULT_check_root -ne 1 ] && [ $force_install_ok -ne 1 ]
|
||||||
|
then
|
||||||
|
# Jump this test
|
||||||
|
ECHO_FORMAT "Root install failed, impossible to perform this test...\n" "lyellow" clog
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
# And with a sub path install
|
||||||
|
else
|
||||||
|
if [ $RESULT_check_sub_dir -ne 1 ] && [ $force_install_ok -ne 1 ]
|
||||||
|
then
|
||||||
|
# Jump this test
|
||||||
|
ECHO_FORMAT "Sub path install failed, impossible to perform this test...\n" "lyellow" clog
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Install the application in a LXC container
|
||||||
|
ECHO_FORMAT "\nPreliminary install...\n" "white" "bold" clog
|
||||||
|
SETUP_APP
|
||||||
|
|
||||||
|
# Analyse the log to extract "warning" and "error" lines
|
||||||
|
LOG_EXTRACTOR
|
||||||
|
|
||||||
|
# Check if the install had work
|
||||||
|
if [ $yunohost_result -ne 0 ]
|
||||||
|
then
|
||||||
|
ECHO_FORMAT "\nInstallation failed...\n" "red" "bold"
|
||||||
|
else
|
||||||
|
ECHO_FORMAT "\nChange the url from $sub_domain$check_path to $new_domain$new_path...\n" "white" "bold" clog
|
||||||
|
|
||||||
|
# Change the url
|
||||||
|
LXC_START "sudo yunohost --debug app change-url $ynh_app_id -d \"$new_domain\" -p \"$new_path\""
|
||||||
|
|
||||||
|
# yunohost_result gets the return code of the upgrade
|
||||||
|
yunohost_result=$?
|
||||||
|
|
||||||
|
# Print the result of the change_url command
|
||||||
|
if [ $yunohost_result -eq 0 ]; then
|
||||||
|
ECHO_FORMAT "Change_url script successful. ($yunohost_result)\n" "white" clog
|
||||||
|
else
|
||||||
|
ECHO_FORMAT "Change_url script failed. ($yunohost_result)\n" "white" clog
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Check all the witness files, to verify if them still here
|
||||||
|
check_witness_files
|
||||||
|
|
||||||
|
# Analyse the log to extract "warning" and "error" lines
|
||||||
|
LOG_EXTRACTOR
|
||||||
|
|
||||||
|
# Try to access the app by its url
|
||||||
|
check_path=$new_path
|
||||||
|
check_domain=$new_domain
|
||||||
|
CHECK_URL
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Check the result and print SUCCESS or FAIL
|
||||||
|
if check_test_result
|
||||||
|
then # Success
|
||||||
|
# The global success for a change_url can't be a success if another change_url failed
|
||||||
|
if [ $RESULT_change_url -ne -1 ]; then
|
||||||
|
RESULT_change_url=1 # Change_url succeed
|
||||||
|
fi
|
||||||
|
else # Fail
|
||||||
|
RESULT_change_url=-1 # Change_url failed
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Make a break if auto_remove is set
|
||||||
|
break_before_continue
|
||||||
|
|
||||||
|
# Stop and restore the LXC container
|
||||||
|
LXC_STOP
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
PACKAGE_LINTER () {
|
PACKAGE_LINTER () {
|
||||||
# Package linter
|
# Package linter
|
||||||
|
|
||||||
|
@ -1224,4 +1373,9 @@ TESTING_PROCESS () {
|
||||||
if [ $backup_restore -eq 1 ]; then
|
if [ $backup_restore -eq 1 ]; then
|
||||||
TEST_LAUNCHER CHECK_BACKUP_RESTORE
|
TEST_LAUNCHER CHECK_BACKUP_RESTORE
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Try the change_url script
|
||||||
|
if [ $change_url -eq 1 ]; then
|
||||||
|
TEST_LAUNCHER CHECK_CHANGE_URL
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue