mirror of
https://github.com/YunoHost/package_check.git
synced 2024-09-03 20:06:20 +02:00
Allow multi-instance without subpath
This commit is contained in:
parent
eee83b8500
commit
b7c5649451
4 changed files with 27 additions and 48 deletions
|
@ -119,7 +119,7 @@ Si un test est absent de la liste, il sera ignoré. Cela revient à le noter à
|
||||||
- `setup_public`: Installation en public.
|
- `setup_public`: Installation en public.
|
||||||
- `upgrade`: Upgrade du package sur la même version. Test uniquement le script upgrade.
|
- `upgrade`: Upgrade du package sur la même version. Test uniquement le script upgrade.
|
||||||
- `backup_restore`: Backup et restauration.
|
- `backup_restore`: Backup et restauration.
|
||||||
- `multi_instance`: Installation de l'application 3 fois de suite, pour vérifier sa capacité à être multi-instance. Les 2e et 3e installations se font respectivement en ajoutant un suffixe et un préfixe au path.
|
- `multi_instance`: Installation de l'application 2 fois de suite, pour vérifier sa capacité à être multi-instance.
|
||||||
- `incorrect_path`: Provoque une erreur avec un path malformé, path/.
|
- `incorrect_path`: Provoque une erreur avec un path malformé, path/.
|
||||||
- `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.
|
||||||
|
|
|
@ -119,7 +119,7 @@ If a test is not in the list, it will be ignored. It's similar to marked at 0.
|
||||||
- `setup_public`: Public installation.
|
- `setup_public`: Public installation.
|
||||||
- `upgrade`: Upgrade package on same version. Only test the upgrade script.
|
- `upgrade`: Upgrade package on same version. Only test the upgrade script.
|
||||||
- `backup_restore`: Backup then restore.
|
- `backup_restore`: Backup then restore.
|
||||||
- `multi_instance`: Installing the application 3 times to verify its ability to be multi-instance. The 2nd and 3rd respectively installs are adding a suffix then prefix path.
|
- `multi_instance`: Installing the application 2 times to verify its ability to be multi-instance.
|
||||||
- `incorrect_path`: Causes an arror with a malformed path, path/.
|
- `incorrect_path`: Causes an arror with a malformed path, path/.
|
||||||
- `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.
|
||||||
|
|
|
@ -813,7 +813,7 @@ initialize_values() {
|
||||||
all_test=0
|
all_test=0
|
||||||
|
|
||||||
# Default path
|
# Default path
|
||||||
test_path=/check
|
test_path=/
|
||||||
}
|
}
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -732,48 +732,38 @@ CHECK_MULTI_INSTANCE () {
|
||||||
|
|
||||||
unit_test_title "Multi-instance installations..."
|
unit_test_title "Multi-instance installations..."
|
||||||
|
|
||||||
# Check if the sub path install have previously work
|
# Check if an install have previously work
|
||||||
if [ $RESULT_check_sub_dir -ne 1 ] && [ $force_install_ok -ne 1 ]
|
local previous_install=$(is_install_failed)
|
||||||
then
|
# Abort if none install worked
|
||||||
# If subdir installation doesn't worked and force_install_ok not setted, aborted this test.
|
[ "$previous_install" = "1" ] && return
|
||||||
ECHO_FORMAT "Sub path install failed, impossible to perform this test...\n" "red" clog
|
|
||||||
return
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Copy original arguments
|
# Copy original arguments
|
||||||
local manifest_args_mod="$manifest_arguments"
|
local manifest_args_mod="$manifest_arguments"
|
||||||
|
|
||||||
# Replace manifest key for the test
|
# Replace manifest key for the test
|
||||||
check_domain=$sub_domain
|
replace_manifest_key "path" "$test_path"
|
||||||
replace_manifest_key "domain" "$check_domain"
|
check_path=$test_path
|
||||||
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"
|
||||||
|
|
||||||
# Install 3 times the same app
|
# Install 2 times the same app
|
||||||
local i=0
|
local i=0
|
||||||
for i in 1 2 3
|
for i in 1 2
|
||||||
do
|
do
|
||||||
# First installation
|
# First installation
|
||||||
if [ $i -eq 1 ]
|
if [ $i -eq 1 ]
|
||||||
then
|
then
|
||||||
local path_1=$test_path
|
check_domain=$main_domain
|
||||||
ECHO_FORMAT "First installation: path=$path_1\n" clog
|
ECHO_FORMAT "First installation: path=$check_domain$check_path\n" clog
|
||||||
check_path=$path_1
|
|
||||||
# Second installation
|
# Second installation
|
||||||
elif [ $i -eq 2 ]
|
elif [ $i -eq 2 ]
|
||||||
then
|
then
|
||||||
local path_2="/2${test_path#/}"
|
check_domain=$sub_domain
|
||||||
ECHO_FORMAT "Second installation: path=$path_2\n" clog
|
ECHO_FORMAT "Second installation: path=$check_domain$check_path\n" clog
|
||||||
check_path=$path_2
|
|
||||||
# Third installation
|
|
||||||
else
|
|
||||||
local path_3="/3-${test_path#/}"
|
|
||||||
ECHO_FORMAT "Third installation: path=$path_3\n" clog
|
|
||||||
check_path=$path_3
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Replace path manifest key for the test
|
# Replace path and domain manifest keys for the test
|
||||||
replace_manifest_key "path" "$check_path"
|
replace_manifest_key "domain" "$check_domain"
|
||||||
|
|
||||||
# Install the application in a LXC container
|
# Install the application in a LXC container
|
||||||
SETUP_APP
|
SETUP_APP
|
||||||
|
@ -789,30 +779,22 @@ CHECK_MULTI_INSTANCE () {
|
||||||
then
|
then
|
||||||
local multi_yunohost_result_2=$yunohost_result
|
local multi_yunohost_result_2=$yunohost_result
|
||||||
local ynh_app_id_2=$ynh_app_id
|
local ynh_app_id_2=$ynh_app_id
|
||||||
# Third installation
|
|
||||||
else
|
|
||||||
local multi_yunohost_result_3=$yunohost_result
|
|
||||||
local ynh_app_id_3=$ynh_app_id
|
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
# Try to access to the 3 apps by theirs url
|
# Try to access to the 2 apps by theirs url
|
||||||
for i in 1 2 3
|
for i in 1 2
|
||||||
do
|
do
|
||||||
# First app
|
# First app
|
||||||
if [ $i -eq 1 ]
|
if [ $i -eq 1 ]
|
||||||
then
|
then
|
||||||
check_path=$path_1
|
check_domain=$main_domain
|
||||||
ynh_app_id=$ynh_app_id_1
|
ynh_app_id=$ynh_app_id_1
|
||||||
# Second app
|
# Second app
|
||||||
elif [ $i -eq 2 ]
|
elif [ $i -eq 2 ]
|
||||||
then
|
then
|
||||||
check_path=$path_2
|
check_domain=$sub_domain
|
||||||
ynh_app_id=$ynh_app_id_2
|
ynh_app_id=$ynh_app_id_2
|
||||||
# Third app
|
|
||||||
else
|
|
||||||
check_path=$path_3
|
|
||||||
ynh_app_id=$ynh_app_id_3
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Try to access the app by its url
|
# Try to access the app by its url
|
||||||
|
@ -830,16 +812,13 @@ CHECK_MULTI_INSTANCE () {
|
||||||
elif [ $i -eq 2 ]
|
elif [ $i -eq 2 ]
|
||||||
then
|
then
|
||||||
multi_yunohost_result_2=1
|
multi_yunohost_result_2=1
|
||||||
# Third app
|
|
||||||
else
|
|
||||||
multi_yunohost_result_3=1
|
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
# Check the result and print SUCCESS or FAIL
|
# Check the result and print SUCCESS or FAIL
|
||||||
# Succeed if first installation works, and either the second or the third works also
|
# Succeed if the 2 installations work;
|
||||||
if [ $multi_yunohost_result_1 -eq 0 ] && ( [ $multi_yunohost_result_2 -eq 0 ] || [ $multi_yunohost_result_3 -eq 0 ] )
|
if [ $multi_yunohost_result_1 -eq 0 ] && [ $multi_yunohost_result_2 -eq 0 ]
|
||||||
then # Success
|
then # Success
|
||||||
check_success
|
check_success
|
||||||
RESULT_check_multi_instance=1
|
RESULT_check_multi_instance=1
|
||||||
|
|
Loading…
Add table
Reference in a new issue