This commit is contained in:
Alexandre Aubin 2020-12-12 00:23:01 +01:00
parent 6f432740cb
commit 925f6cdbe8
4 changed files with 297 additions and 388 deletions

View file

@ -289,20 +289,17 @@ COMPUTE_RESULTS_SUMMARY () {
# Print the result for each test
echo -e "\n\n"
print_result "Package linter" $RESULT_linter
print_result "Install" $RESULT_global_setup
print_result "Remove" $RESULT_global_remove
print_result "Install (subpath)" $RESULT_check_sub_dir
print_result "Remove (subpath)" $RESULT_check_remove_sub_dir
print_result "Install (root)" $RESULT_check_root
print_result "Remove (root)" $RESULT_check_remove_root
print_result "Upgrade" $RESULT_check_upgrade
print_result "Install (subpath)" $RESULT_check_sub_dir
print_result "Install (no url)" $RESULT_check_nourl
print_result "Install (private mode)" $RESULT_check_private
print_result "Install (public mode)" $RESULT_check_public
print_result "Install (multi-instance)" $RESULT_check_multi_instance
print_result "Port already used" $RESULT_check_port
print_result "Upgrade" $RESULT_check_upgrade
print_result "Backup" $RESULT_check_backup
print_result "Restore" $RESULT_check_restore
print_result "Change URL" $RESULT_change_url
print_result "Port already used" $RESULT_check_port
print_result "Actions and config-panel" $RESULT_action_config_panel
# Determine the level for this app
@ -330,16 +327,13 @@ COMPUTE_RESULTS_SUMMARY () {
pass_level_1() {
# -> The package can be install and remove.
[ $RESULT_global_setup -eq 1 ] && \
[ $RESULT_global_remove -eq 1 ]
}
pass_level_2() {
# -> The package can be install and remove in all tested configurations.
# Validated if none install failed
[ $RESULT_check_sub_dir -ne -1 ] && \
[ $RESULT_check_remove_sub_dir -ne -1 ] && \
[ $RESULT_check_root -ne -1 ] && \
[ $RESULT_check_remove_root -ne -1 ] && \
[ $RESULT_check_private -ne -1 ] && \
[ $RESULT_check_public -ne -1 ] && \
[ $RESULT_check_multi_instance -ne -1 ]
@ -450,11 +444,6 @@ COMPUTE_RESULTS_SUMMARY () {
# So this level will set at 0.
level[i]=0
# If the level is at 'na', it will be ignored
elif [ "${level[i]}" == "na" ]
then
continue
# If the level is at 1 or 2. The global level will be set at this level
elif [ "${level[i]}" -ge 1 ]
then
@ -496,9 +485,7 @@ COMPUTE_RESULTS_SUMMARY () {
for i in `seq 1 10`
do
display="0"
if [ "${level[$i]}" == "na" ]; then
display="N/A"
elif [ "${level[$i]}" -ge 1 ]; then
if [ "${level[$i]}" -ge 1 ]; then
display="1"
fi
echo -e "\t Level $i: $display"
@ -521,12 +508,9 @@ RESULT_linter_level_6=0
RESULT_linter_level_7=0
RESULT_linter_level_8=0
RESULT_linter_broken=0
RESULT_global_setup=0
RESULT_global_remove=0
RESULT_check_sub_dir=0
RESULT_check_root=0
RESULT_check_remove_sub_dir=0
RESULT_check_remove_root=0
RESULT_check_nourl=0
RESULT_check_upgrade=0
RESULT_check_backup=0
RESULT_check_restore=0
@ -612,19 +596,14 @@ parse_check_process() {
extract_check_process_section "^$tests_serie" "^;;" > $test_serie_rawconf
extract_check_process_section "^; pre-install" "^; " $test_serie_rawconf > $test_serie_dir/preinstall.sh.template
# This is the arg list to be later fed to "yunohost app install"
# Looking like domain=foo.com&path=/bar&password=stuff
# "Standard" arguments like domain/path will later be overwritten
# during tests
extract_check_process_section "^; Manifest" "^; " $test_serie_rawconf | awk '{print $1}' | tr -d '"' | tr '\n' '&' > $test_serie_dir/install_args
extract_check_process_section "^; Actions" "^; " $test_serie_rawconf > $test_serie_dir/check_process.actions_infos
extract_check_process_section "^; Config_panel" "^; " $test_serie_rawconf > $test_serie_dir/check_process.configpanel_infos
extract_check_process_section "^; Checks" "^; " $test_serie_rawconf > $test_serie_dir/check_process.tests_infos
# This is the test of commits to test upgrade from
for LINE in $(grep "^upgrade=1" "$test_serie_dir/check_process.tests_infos")
do
commit=$(echo $LINE | grep -o "from_commit=.*" | awk -F= '{print $2}')
[ -n "$commit" ] || commit="current"
echo $commit >> $test_serie_dir/upgrades_to_test
done
is_test_enabled () {
# Find the line for the given check option
local value=$(grep -m1 -o "^$1=." "$test_serie_dir/check_process.tests_infos" | awk -F= '{print $2}')
@ -640,21 +619,40 @@ parse_check_process() {
fi
}
cat << EOF > $test_serie_dir/tests_to_perform
pkg_linter=$(is_test_enabled pkg_linter)
setup_sub_dir=$(is_test_enabled setup_sub_dir)
setup_root=$(is_test_enabled setup_root)
setup_nourl=$(is_test_enabled setup_nourl)
setup_private=$(is_test_enabled setup_private)
setup_public=$(is_test_enabled setup_public)
upgrade=$(is_test_enabled upgrade)
backup_restore=$(is_test_enabled backup_restore)
multi_instance=$(is_test_enabled multi_instance)
port_already_use=$(is_test_enabled port_already_use)
change_url=$(is_test_enabled change_url)
actions=$(is_test_enabled actions)
config_panel=$(is_test_enabled config_panel)
EOF
is_test_enabled pkg_linter && echo "PACKAGE_LINTER" >> $test_serie_dir/tests_to_perform
is_test_enabled setup_sub_dir && echo "TEST_INSTALL subdir " >> $test_serie_dir/tests_to_perform
is_test_enabled setup_root && echo "TEST_INSTALL root" >> $test_serie_dir/tests_to_perform
is_test_enabled setup_nourl && echo "TEST_INSTALL nourl" >> $test_serie_dir/tests_to_perform
is_test_enabled setup_private && echo "TEST_PUBLIC_PRIVATE private" >> $test_serie_dir/tests_to_perform
is_test_enabled setup_public && echo "TEST_PUBLIC_PRIVATE public" >> $test_serie_dir/tests_to_perform
is_test_enabled multi_instance && echo "TEST_MULTI_INSTANCE" >> $test_serie_dir/tests_to_perform
is_test_enabled backup_restore && echo "TEST_BACKUP_RESTORE" >> $test_serie_dir/tests_to_perform
# Upgrades
for LINE in $(grep "^upgrade=1" "$test_serie_dir/check_process.tests_infos")
do
commit=$(echo $LINE | grep -o "from_commit=.*" | awk -F= '{print $2}')
[ -n "$commit" ] || commit="current"
echo "TEST_UPGRADE $commit" >> $test_serie_dir/tests_to_perform
done
# "Advanced" features
is_test_enabled change_url && echo "TEST_CHANGE_URL" >> $test_serie_dir/tests_to_perform
is_test_enabled actions && echo "ACTIONS_CONFIG_PANEL actions" >> $test_serie_dir/tests_to_perform
is_test_enabled config_panel && echo "ACTIONS_CONFIG_PANEL config_panel" >> $test_serie_dir/tests_to_perform
# Port already used ... do we really need this ...
if grep -q -m1 "port_already_use=1" "$test_serie_dir/check_process.tests_infos"
then
local check_port=$(grep -m1 "port_already_use=1" "$test_serie_dir/check_process.tests_infos" | grep -o -E "\([0-9]+\)" | tr -d '()')
else
local check_port=6660
fi
is_test_enabled port_already_use && echo "TEST_PORT_ALREADY_USED $check_port" >> $test_serie_dir/tests_to_perform
done 3<<< "$(grep "^;; " "$check_process")"
@ -677,19 +675,20 @@ guess_test_configuration() {
python "./sub_scripts/manifest_parsing.py" "$package_path/manifest.json" \
| cut -d ':' -f1,2 | tr ':' '=' | tr '\n' '&' > $test_serie_dir/install_args
cat << EOF > $test_serie_dir/tests_to_perform
pkg_linter=1
setup_sub_dir=1
setup_root=1
setup_nourl=0
setup_private=$(grep -q "is_public=" $test_serie_dir/install_args && echo 1 || echo 0)
setup_public=$(grep -q "is_public=" $test_serie_dir/install_args && echo 1 || echo 0)0
upgrade=1
backup_restore=1
multi_instance=$(grep multi_instance "$package_path/manifest.json" | grep -q true && echo 1 || echo 0)
port_already_use=0
change_url=0
EOF
echo "PACKAGE_LINTER" >> $test_serie_dir/tests_to_perform
echo "TEST_INSTALL subdir" >> $test_serie_dir/tests_to_perform
echo "TEST_INSTALL root" >> $test_serie_dir/tests_to_perform
if grep -q "is_public=" $test_serie_dir/install_args
then
echo "TEST_PUBLIC_PRIVATE private" >> $test_serie_dir/tests_to_perform
echo "TEST_PUBLIC_PRIVATE public" >> $test_serie_dir/tests_to_perform
fi
if grep multi_instance "$package_path/manifest.json" | grep -q true
then
echo "TEST_MULTI_INSTANCE" >> $test_serie_dir/tests_to_perform
fi
echo "TEST_BACKUP_RESTORE" >> $test_serie_dir/tests_to_perform
echo "TEST_UPGRADE current" >> $test_serie_dir/tests_to_perform
}
#=================================================
@ -701,7 +700,6 @@ run_all_tests() {
# And keep this value separately
complete_start_timer=$starttime
LXC_INIT
for test_serie_id in $test_series
@ -719,7 +717,7 @@ run_all_tests() {
# Print the final results of the tests
COMPUTE_RESULTS_SUMMARY $test_serie_id
# FIXME FIXME FIXME gotta reset the snapshot
LXC_PURGE_SNAPSHOTS
done
# Restore the started time for the timer

View file

@ -88,10 +88,10 @@ LXC_INIT () {
sudo rm --force $LXC_ROOTFS/swap_*
sudo swapoff $LXC_SNAPSHOTS/snap0/rootfs/swap_* 2>/dev/null
sudo rm --force $LXC_SNAPSHOTS/snap0/rootfs/swap_*
sudo swapoff $LXC_SNAPSHOTS/snap_rootinstall/rootfs/swap_* 2>/dev/null
sudo rm --force $LXC_SNAPSHOTS/snap_rooinstall/rootfs/swap_*
sudo swapoff $LXC_SNAPSHOTS/snap_subdirintsall/rootfs/swap_* 2>/dev/null
sudo rm --force $LXC_SNAPSHOTS/snap_subdirinstall/rootfs/swap_*
sudo swapoff $LXC_SNAPSHOTS/snap_afterinstall/rootfs/swap_* 2>/dev/null
sudo rm --force $LXC_SNAPSHOTS/snap_afterinstall/rootfs/swap_*
LXC_PURGE_SNAPSHOTS
# Initialize LXC network
@ -106,6 +106,15 @@ LXC_INIT () {
sudo iptables --table nat --append POSTROUTING --source $LXC_NETWORK.0/24 --jump MASQUERADE | tee --append "$complete_log" 2>&1
}
LXC_PURGE_SNAPSHOTS() {
LXC_STOP
for SNAP in $(sudo ls $LXC_SNAPSHOTS/snap_*install)
do
sudo lxc-snapshot -n $LXC_NAME -d $(basename $SNAP)
done
}
LXC_START () {
# Start the lxc container and execute the given command in it
local cmd=$1

View file

@ -8,23 +8,34 @@ assert_we_are_the_setup_user
touch "$lock_file"
log_title "Retire l'ip forwarding."
sudo rm -f /etc/sysctl.d/lxc_pchecker.conf
sudo sysctl -p
log_title "Désactive le bridge réseau"
sudo ifdown --force $LXC_BRIDGE
log_title "Supprime le brige réseau"
sudo rm -f /etc/network/interfaces.d/$LXC_BRIDGE
log_title "Suppression de la machine et de son snapshots"
sudo lxc-snapshot -n $LXC_NAME -d snap0
sudo lxc-snapshot -n $LXC_NAME -d snap_rootinstall
sudo lxc-snapshot -n $LXC_NAME -d snap_subdirinstall
for SNAP in $(sudo ls $LXC_SNAPSHOTS/snap_*install)
do
sudo lxc-snapshot -n $LXC_NAME -d $(basename $SNAP)
done
sudo rm -f /var/lib/lxcsnaps/$LXC_NAME/snap0.tar.gz
sudo lxc-destroy -n $LXC_NAME -f
log_title "Suppression des lignes de pchecker_lxc dans $HOME/.ssh/config"
BEGIN_LINE=$(cat $HOME/.ssh/config | grep -n "^# ssh pchecker_lxc$" | cut -d':' -f 1 | tail -n1)
sed -i "$BEGIN_LINE,/^IdentityFile/d" $HOME/.ssh/config

View file

@ -55,6 +55,27 @@ GET_RESULT() {
grep "RESULT_$1=" $test_serie_dir/results | awk -F= '{print $2}'
}
at_least_one_install_succeeded () {
[ "$(GET_RESULT check_sub_dir)" -eq 1 ] \
|| [ "$(GET_RESULT check_root)" -eq 1 ] \
|| [ "$(GET_RESULT check_nourl)" -eq 1 ] \
|| { log_error "All installs failed, therefore the following tests cannot be performed...";
return 1; }
}
this_is_a_web_app () {
# Usually the fact that we test "nourl"
# installs should be a good indicator for this
grep "TEST_INSTALL nourl" $test_serie_dir/tests_to_perform && return 1
}
default_install_path() {
this_is_a_web_app && echo ""
|| [ "$(GET_RESULT check_sub_dir)" -eq 1 ] && echo "/path "
|| echo "/"
}
#=================================================
# Install and remove an app
#=================================================
@ -102,10 +123,19 @@ INSTALL_APP () {
return $ret
}
path_to_install_type() {
local check_path="$1"
[ -z "$check_path" ] && echo "nourl" \
|| [ "$check_path" == "/" ] && echo "root" \
|| echo "subdir"
}
LOAD_SNAPSHOT_OR_INSTALL_APP () {
local check_path="$1"
local _install_type=$([ "$check_path" = "/" ] && echo "root" || echo "subdir")
local _install_type=$(path_to_install_type $check_path)
local snapname="snap_${_install_type}install"
if [ ! -e "$LXC_SNAPSHOTS/$snapname" ]
@ -121,6 +151,7 @@ LOAD_SNAPSHOT_OR_INSTALL_APP () {
fi
}
REMOVE_APP () {
# Remove an application
@ -151,8 +182,8 @@ VALIDATE_THAT_APP_CAN_BE_ACCESSED () {
local fell_on_sso_portal=0
local curl_output=$test_serie_dir/curl_output
# Not checking this if this ain't relevant for the current test / app
[ $enable_validate_that_app_can_be_accessed == "true" ] || return 0
# Not checking this if this ain't relevant for the current app
this_is_a_web_app || return 0
log_small_title "Validating that the app can (or cannot) be accessed with its url..."
@ -253,7 +284,7 @@ VALIDATE_THAT_APP_CAN_BE_ACCESSED () {
log_debug "HTTP code: $http_code"
log_debug "$test_url_details"
log_debug "Page title: $page_title"
log_debug "Page extract: $page_extract"
log_debug "Page extract:\n$page_extract"
if [[ $curl_error -ne 0 ]]
then
@ -262,7 +293,7 @@ VALIDATE_THAT_APP_CAN_BE_ACCESSED () {
log_warning "HTTP code: $http_code"
log_warning "$test_url_details"
log_warning "Page title: $page_title"
log_warning "Page extract: $page_extract"
log_warning "Page extract:\n$page_extract"
fi
done
@ -285,21 +316,6 @@ VALIDATE_THAT_APP_CAN_BE_ACCESSED () {
return 0
}
#=================================================
# Generic functions for unit tests
#=================================================
validate_that_at_least_one_install_succeeded () {
if [ $(GET_RESULT check_sub_dir) -eq 0 ] && [ $(GET_RESULT check_root) -eq 0 ]
then
log_error "All installs failed, therefore this test cannot be performed..."
return 1
fi
}
#=================================================
# Unit tests
#=================================================
@ -311,7 +327,8 @@ TEST_INSTALL () {
local install_type=$1
[ "$install_type" = "subdir" ] && { start_test "Installation in a sub path"; local check_path=/path; }
[ "$install_type" = "root" ] && { start_test "Installation on the root"; local check_path=/; }
[ "$install_type" = "no_url" ] && { start_test "Installation without url access"; local check_path=""; }
[ "$install_type" = "nourl" ] && { start_test "Installation without url access"; local check_path=""; }
local snapname=snap_${install_type}install
LOAD_LXC_SNAPSHOT snap0
@ -319,74 +336,32 @@ TEST_INSTALL () {
INSTALL_APP "path=$check_path" \
&& VALIDATE_THAT_APP_CAN_BE_ACCESSED $SUBDOMAIN $check_path
# Check the result and print SUCCESS or FAIL
if [ $? -eq 0 ]
then
SET_RESULT global_setup 1
local check_result_setup=1
local install=$?
if [ "$install_type" = "root" ]
then
[ -e "$LXC_SNAPSHOTS/snap_rootinstall" ] \
&& log_debug "Create a snapshot for root installation." \
&& CREATE_LXC_SNAPSHOT snap_rootinstall
else
# Check if a snapshot already exist for a subpath (or no_url) install
[ ! -e "$LXC_SNAPSHOTS/snap_subdirinstall" ] \
&& log_debug "Create a snapshot for sub path installation." \
&& CREATE_LXC_SNAPSHOT snap_subdirinstall
fi
else
SET_RESULT_IF_NONE_YET global_setup -1
local check_result_setup=-1
fi
# Create the snapshot that'll be used by other tests later
[ $install -eq 0 ] \
&& [ ! -e "$LXC_SNAPSHOTS/$snapname" ] \
&& log_debug "Create a snapshot after app install" \
&& CREATE_LXC_SNAPSHOT $snapname
# Remove the application
REMOVE_APP
if [ $? -eq 0 ]
then
local check_result_remove=1
SET_RESULT global_remove 1
else
# The global success for a deletion can't be failed if another remove succeed
SET_RESULT_IF_NONE_YET global_remove -1
local check_result_remove=-1
fi
# Remove and reinstall the application
[ $install -eq 0 ] \
&& log_small_title "Remove and reinstall the application after a removal." \
&& REMOVE_APP \
&& INSTALL_APP "path=$check_path" \
&& VALIDATE_THAT_APP_CAN_BE_ACCESSED $SUBDOMAIN $check_path
# Reinstall the application after the removing
# Try to resintall only if the first install is a success.
if [ $check_result_setup -eq 1 ]
then
log_small_title "Reinstall the application after a removing."
INSTALL_APP "path=$check_path" \
&& VALIDATE_THAT_APP_CAN_BE_ACCESSED $SUBDOMAIN $check_path
# Check the result and print SUCCESS or FAIL
[ $? -eq 0 ] && local check_result_setup=1 || local check_result_setup=-1
fi
# Fill the correct variable depend on the type of test
if [ "$install_type" = "subdir" ]
then
SET_RESULT check_sub_dir $check_result_setup
SET_RESULT check_remove_sub_dir $check_result_remove
else # root and no_url
SET_RESULT check_root $check_result_setup
SET_RESULT check_remove_root $check_result_remove
fi
[ $? -eq 0 ] \
&& SET_RESULT check_$install_type 1 \
|| SET_RESULT check_$install_type -1
break_before_continue
}
TEST_UPGRADE () {
[ $(GET_RESULT check_sub_dir) -eq 1 ] && local check_path=/path || local check_path=/
# Do an upgrade test for each commit in the upgrade list
for commit in $(cat $test_serie_dir/upgrades_to_test)
do
if [ "$commit" == "current" ]
then
start_test "Upgrade from the same version"
@ -398,7 +373,9 @@ TEST_UPGRADE () {
start_test "Upgrade from $upgrade_name"
fi
validate_that_at_least_one_install_succeeded || return
at_least_one_install_succeeded || return
local check_path=$(default_install_path)
# Install the application in a LXC container
log_small_title "Preliminary install..."
@ -452,18 +429,15 @@ TEST_UPGRADE () {
# Remove the application
REMOVE_APP
done
}
TEST_PUBLIC_PRIVATE () {
# Try to install in public or private mode
# $1 = install type
local install_type=$1
[ "$install_type" = "private" ] && start_test "Installation in private mode"
[ "$install_type" = "public" ] && start_test "Installation in public mode"
validate_that_at_least_one_install_succeeded || return
at_least_one_install_succeeded || return
# Set public or private according to type of test requested
if [ "$install_type" = "private" ]; then
@ -526,18 +500,13 @@ TEST_PUBLIC_PRIVATE () {
}
TEST_MULTI_INSTANCE () {
# Try multi-instance installations
start_test "Multi-instance installations"
# Check if an install have previously work
validate_that_at_least_one_install_succeeded || return
[ $(GET_RESULT check_sub_dir) -eq 1 ] && local check_path=/path || local check_path=/
local multi_yunohost_result_1=0
local multi_yunohost_result_2=0
at_least_one_install_succeeded || return
local check_path=$(default_install_path)
LOAD_LXC_SNAPSHOT snap0
@ -559,22 +528,14 @@ TEST_MULTI_INSTANCE () {
}
TEST_PORT_ALREADY_USED () {
# Try to install with specific complications
# $1 = install type
start_test "Port already used"
# Check if an install have previously work
validate_that_at_least_one_install_succeeded || return
at_least_one_install_succeeded || return
# Use a path according to previous succeeded installs
if grep -q -m1 "port_already_use=1" "$test_serie_dir/check_process.tests_infos"
then
local check_port=$(grep -m1 "port_already_use=1" "$test_serie_dir/check_process.tests_infos" | grep -o -E "\([0-9]+\)" | tr -d '()')
else
local check_port=6660
fi
local check_port=$1
local check_path=$(default_install_path)
LOAD_LXC_SNAPSHOT snap0
@ -587,8 +548,6 @@ TEST_PORT_ALREADY_USED () {
# Then start this service to block this port.
LXC_START "sudo systemctl enable netcat & sudo systemctl start netcat"
[ $(GET_RESULT check_sub_dir) -eq 1 ] && local check_path=/path || local check_path=/
# Install the application in a LXC container
INSTALL_APP "path=$check_path" "port=$check_port" \
&& VALIDATE_THAT_APP_CAN_BE_ACCESSED $SUBDOMAIN $check_path
@ -599,42 +558,15 @@ TEST_PORT_ALREADY_USED () {
}
TEST_BACKUP_RESTORE () {
# Try to backup then restore the app
start_test "Backup/Restore"
# Check if an install have previously work
validate_that_at_least_one_install_succeeded || return
at_least_one_install_succeeded || return
# Try in 2 times, first in root and second in sub path.
local i=0
for i in 0 1
do
# First, try with a root install
if [ $i -eq 0 ]
then
# Check if root installation worked, or if force_install_ok is setted.
if [ $(GET_RESULT check_root) -eq 0 ]
then
log_warning "Root install failed, therefore this test cannot be performed..."
continue
fi
local check_path=/
log_small_title "Preliminary installation on the root..."
# Second, try with a sub path install
elif [ $i -eq 1 ]
then
# Check if sub path installation worked, or if force_install_ok is setted.
if [ $(GET_RESULT check_sub_dir) -eq 1 ]
then
log_warning "Sub path install failed, therefore this test cannot be performed..."
continue
fi
local check_path=/path
log_small_title "Preliminary installation in a sub path..." "white" "bold" clog
fi
local check_path=$(default_install_path)
# Install the application in a LXC container
LOAD_SNAPSHOT_OR_INSTALL_APP "$check_path"
@ -724,7 +656,6 @@ TEST_BACKUP_RESTORE () {
# Stop and restore the LXC container
LXC_STOP
done
done
}
TEST_CHANGE_URL () {
@ -733,13 +664,14 @@ TEST_CHANGE_URL () {
start_test "Change URL"
# Check if an install have previously work
validate_that_at_least_one_install_succeeded || return
at_least_one_install_succeeded || return
this_is_a_web_app || return
# 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 7`
for i in $(seq 1 7)
do
# Same domain, root to path
if [ $i -eq 1 ]; then
@ -878,13 +810,11 @@ ACTIONS_CONFIG_PANEL () {
fi
# Check if an install have previously work
validate_that_at_least_one_install_succeeded || return
# Use a path according to previous succeeded installs
[ $(GET_RESULT check_sub_dir) -eq 1 ] && local check_path=/path || local check_path=/
at_least_one_install_succeeded || return
# Install the application in a LXC container
log_small_title "Preliminary install..."
local check_path=$(default_install_path)
LOAD_SNAPSHOT_OR_INSTALL_APP "$check_path"
validate_action_config_panel()
@ -1277,6 +1207,7 @@ check_witness_files () {
[ $(GET_RESULT witness) -eq 1 ] && return 1 || return 0
}
RUN_TEST_SERIE() {
# Launch all tests successively
test_serie_dir=$1
@ -1293,54 +1224,16 @@ RUN_TEST_SERIE() {
# Print the version of YunoHost from the LXC container
LXC_START "sudo yunohost --version"
source $test_serie_dir/tests_to_perform
# Init the value for the current test
current_test_number=1
# We will chech that the app can be accessed
# (except if it's a no-url app)
[ $setup_nourl -eq 0 ] \
&& enable_validate_that_app_can_be_accessed="true" \
||enable_validate_that_app_can_be_accessed="false"
# The list of test contains for example "TEST_UPGRADE some_commit_id"
for test in $test_serie_dir/tests_to_perform
do
TEST_LAUNCHER $test
done
# Check the package with package linter
[ $pkg_linter -eq 1 ] && PACKAGE_LINTER
# Try to install in a sub path
[ $setup_sub_dir -eq 1 ] && TEST_LAUNCHER TEST_INSTALL subdir
# Try to install on root
[ $setup_root -eq 1 ] && TEST_LAUNCHER TEST_INSTALL root
# Try to install without url access
[ $setup_nourl -eq 1 ] && TEST_LAUNCHER TEST_INSTALL no_url
# Try the upgrade script
[ $upgrade -eq 1 ] && TEST_LAUNCHER TEST_UPGRADE
# Try to install in private mode
[ $setup_private -eq 1 ] && TEST_LAUNCHER TEST_PUBLIC_PRIVATE private
# Try to install in public mode
[ $setup_public -eq 1 ] && TEST_LAUNCHER TEST_PUBLIC_PRIVATE public
# Try multi-instance installations
[ $multi_instance -eq 1 ] && TEST_LAUNCHER TEST_MULTI_INSTANCE
# Try to install with a port already used
[ $port_already_use -eq 1 ] && TEST_LAUNCHER TEST_PORT_ALREADY_USED
# Try to backup then restore the app
[ $backup_restore -eq 1 ] && TEST_LAUNCHER TEST_BACKUP_RESTORE
# Try the change_url script
[ $change_url -eq 1 ] && TEST_LAUNCHER TEST_CHANGE_URL
# Try the actions
[ $actions -eq 1 ] && TEST_LAUNCHER ACTIONS_CONFIG_PANEL actions
# Try the config-panel
[ $config_panel -eq 1 ] && TEST_LAUNCHER ACTIONS_CONFIG_PANEL config_panel
}
TEST_LAUNCHER () {
@ -1356,18 +1249,16 @@ TEST_LAUNCHER () {
# Execute the test
$1 $2
# Stop and restore the LXC container
LXC_STOP
# Restore the started time for the timer
starttime=$global_start_timer
# End the timer for the test
stop_timer 2
LXC_STOP
# Update the lock file with the date of the last finished test.
# $$ is the PID of package_check itself.
echo "$1 $2:$(date +%s):$$" > "$lock_file"
}