mirror of
https://github.com/YunoHost/package_check.git
synced 2024-09-03 20:06:20 +02:00
Autoindent
This commit is contained in:
parent
2ef016b842
commit
6f432740cb
3 changed files with 87 additions and 87 deletions
|
@ -591,7 +591,7 @@ parse_check_process() {
|
||||||
mkdir -p $TEST_CONTEXT/upgrades.d
|
mkdir -p $TEST_CONTEXT/upgrades.d
|
||||||
for commit in $(cat $TEST_CONTEXT/check_process.upgrade_options | grep "^; commit=.*" | awk -F= '{print $2}')
|
for commit in $(cat $TEST_CONTEXT/check_process.upgrade_options | grep "^; commit=.*" | awk -F= '{print $2}')
|
||||||
do
|
do
|
||||||
cat $TEST_CONTEXT/check_process.upgrade_options | sed -n -e "/^;; $commit/,/^;;/ p" | grep -v "^;;" > $TEST_CONTEXT/upgrades
|
cat $TEST_CONTEXT/check_process.upgrade_options | sed -n -e "/^;; $commit/,/^;;/ p" | grep -v "^;;" > $TEST_CONTEXT/upgrades
|
||||||
done
|
done
|
||||||
rm $TEST_CONTEXT/check_process.upgrade_options
|
rm $TEST_CONTEXT/check_process.upgrade_options
|
||||||
|
|
||||||
|
@ -617,12 +617,12 @@ parse_check_process() {
|
||||||
extract_check_process_section "^; Config_panel" "^; " $test_serie_rawconf > $test_serie_dir/check_process.configpanel_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
|
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
|
# This is the test of commits to test upgrade from
|
||||||
for LINE in $(grep "^upgrade=1" "$test_serie_dir/check_process.tests_infos")
|
for LINE in $(grep "^upgrade=1" "$test_serie_dir/check_process.tests_infos")
|
||||||
do
|
do
|
||||||
commit=$(echo $LINE | grep -o "from_commit=.*" | awk -F= '{print $2}')
|
commit=$(echo $LINE | grep -o "from_commit=.*" | awk -F= '{print $2}')
|
||||||
[ -n "$commit" ] || commit="current"
|
[ -n "$commit" ] || commit="current"
|
||||||
echo $commit >> $test_serie_dir/upgrades_to_test
|
echo $commit >> $test_serie_dir/upgrades_to_test
|
||||||
done
|
done
|
||||||
|
|
||||||
is_test_enabled () {
|
is_test_enabled () {
|
||||||
|
@ -675,7 +675,7 @@ guess_test_configuration() {
|
||||||
|
|
||||||
|
|
||||||
python "./sub_scripts/manifest_parsing.py" "$package_path/manifest.json" \
|
python "./sub_scripts/manifest_parsing.py" "$package_path/manifest.json" \
|
||||||
| cut -d ':' -f1,2 | tr ':' '=' | tr '\n' '&' > $test_serie_dir/install_args
|
| cut -d ':' -f1,2 | tr ':' '=' | tr '\n' '&' > $test_serie_dir/install_args
|
||||||
|
|
||||||
cat << EOF > $test_serie_dir/tests_to_perform
|
cat << EOF > $test_serie_dir/tests_to_perform
|
||||||
pkg_linter=1
|
pkg_linter=1
|
||||||
|
@ -734,8 +734,8 @@ run_all_tests() {
|
||||||
}
|
}
|
||||||
|
|
||||||
[ -e "$check_process" ] \
|
[ -e "$check_process" ] \
|
||||||
&& parse_check_process \
|
&& parse_check_process \
|
||||||
|| guess_test_configuration
|
|| guess_test_configuration
|
||||||
|
|
||||||
run_all_tests
|
run_all_tests
|
||||||
|
|
||||||
|
|
|
@ -153,7 +153,7 @@ LXC_START () {
|
||||||
log_info "Rebooting the container..."
|
log_info "Rebooting the container..."
|
||||||
fi
|
fi
|
||||||
LXC_STOP
|
LXC_STOP
|
||||||
# Try to ping security.debian.org to check the connectivity from the container
|
# Try to ping security.debian.org to check the connectivity from the container
|
||||||
elif ! ssh $arg_ssh -o ConnectTimeout=60 $LXC_NAME "sudo ping -q -c 2 security.debian.org > /dev/null 2>&1; exit \$?" >> "$complete_log" 2>&1
|
elif ! ssh $arg_ssh -o ConnectTimeout=60 $LXC_NAME "sudo ping -q -c 2 security.debian.org > /dev/null 2>&1; exit \$?" >> "$complete_log" 2>&1
|
||||||
then
|
then
|
||||||
log_critical "The container failed to connect to internet..."
|
log_critical "The container failed to connect to internet..."
|
||||||
|
@ -162,7 +162,7 @@ LXC_START () {
|
||||||
log_info "Rebooting the container..."
|
log_info "Rebooting the container..."
|
||||||
fi
|
fi
|
||||||
LXC_STOP
|
LXC_STOP
|
||||||
# Create files to check if the remove script does not remove them accidentally
|
# Create files to check if the remove script does not remove them accidentally
|
||||||
else
|
else
|
||||||
[ $avoid_witness -eq 0 ] && set_witness_files
|
[ $avoid_witness -eq 0 ] && set_witness_files
|
||||||
|
|
||||||
|
|
|
@ -111,13 +111,13 @@ LOAD_SNAPSHOT_OR_INSTALL_APP () {
|
||||||
if [ ! -e "$LXC_SNAPSHOTS/$snapname" ]
|
if [ ! -e "$LXC_SNAPSHOTS/$snapname" ]
|
||||||
then
|
then
|
||||||
LOAD_LXC_SNAPSHOT snap0 \
|
LOAD_LXC_SNAPSHOT snap0 \
|
||||||
&& INSTALL_APP "path=$check_path" \
|
&& INSTALL_APP "path=$check_path" \
|
||||||
&& log_debug "Creating a snapshot for $_install_type installation." \
|
&& log_debug "Creating a snapshot for $_install_type installation." \
|
||||||
&& CREATE_LXC_SNAPSHOT $snapname
|
&& CREATE_LXC_SNAPSHOT $snapname
|
||||||
else
|
else
|
||||||
# Or uses an existing snapshot
|
# Or uses an existing snapshot
|
||||||
log_debug "Reusing an existing snapshot for $_install_type installation." \
|
log_debug "Reusing an existing snapshot for $_install_type installation." \
|
||||||
&& LOAD_LXC_SNAPSHOT $snapname
|
&& LOAD_LXC_SNAPSHOT $snapname
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -164,7 +164,7 @@ VALIDATE_THAT_APP_CAN_BE_ACCESSED () {
|
||||||
RUN_YUNOHOST_CMD "app setting $app_id_to_check skipped_uris -v \"/\""
|
RUN_YUNOHOST_CMD "app setting $app_id_to_check skipped_uris -v \"/\""
|
||||||
# Regen the config of sso
|
# Regen the config of sso
|
||||||
RUN_YUNOHOST_CMD "app ssowatconf"
|
RUN_YUNOHOST_CMD "app ssowatconf"
|
||||||
expected_to_be="public"
|
expected_to_be="public"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Try to access to the url in 2 times, with a final / and without
|
# Try to access to the url in 2 times, with a final / and without
|
||||||
|
@ -179,12 +179,12 @@ VALIDATE_THAT_APP_CAN_BE_ACCESSED () {
|
||||||
# Remove the previous curl output
|
# Remove the previous curl output
|
||||||
rm -f "$curl_output"
|
rm -f "$curl_output"
|
||||||
|
|
||||||
local http_code="noneyet"
|
local http_code="noneyet"
|
||||||
|
|
||||||
local retry=0
|
local retry=0
|
||||||
function should_retry() {
|
function should_retry() {
|
||||||
[ "${http_code}" = "noneyet" ] || [ "${http_code}" = "502" ] || [ "${http_code}" = "503" ] || [ "${http_code}" = "504" ]
|
[ "${http_code}" = "noneyet" ] || [ "${http_code}" = "502" ] || [ "${http_code}" = "503" ] || [ "${http_code}" = "504" ]
|
||||||
}
|
}
|
||||||
|
|
||||||
while [ $retry -lt 3 ] && should_retry;
|
while [ $retry -lt 3 ] && should_retry;
|
||||||
do
|
do
|
||||||
|
@ -216,16 +216,16 @@ VALIDATE_THAT_APP_CAN_BE_ACCESSED () {
|
||||||
retry=$((retry+1))
|
retry=$((retry+1))
|
||||||
done
|
done
|
||||||
|
|
||||||
# Analyze the http code (we're looking for 0xx 4xx 5xx 6xx codes)
|
# Analyze the http code (we're looking for 0xx 4xx 5xx 6xx codes)
|
||||||
if [ -n "$http_code" ] && echo "0 4 5 6" | grep -q "${http_code:0:1}"
|
if [ -n "$http_code" ] && echo "0 4 5 6" | grep -q "${http_code:0:1}"
|
||||||
then
|
then
|
||||||
# If the http code is a 0xx 4xx or 5xx, it's an error code.
|
# If the http code is a 0xx 4xx or 5xx, it's an error code.
|
||||||
curl_error=1
|
curl_error=1
|
||||||
|
|
||||||
# 401 is "Unauthorized", so is a answer of the server. So, it works!
|
# 401 is "Unauthorized", so is a answer of the server. So, it works!
|
||||||
[ "${http_code}" == "401" ] && curl_error=0
|
[ "${http_code}" == "401" ] && curl_error=0
|
||||||
|
|
||||||
[ $curl_error -eq 1 ] && log_error "The HTTP code shows an error."
|
[ $curl_error -eq 1 ] && log_error "The HTTP code shows an error."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Analyze the output of curl
|
# Analyze the output of curl
|
||||||
|
@ -233,14 +233,14 @@ VALIDATE_THAT_APP_CAN_BE_ACCESSED () {
|
||||||
then
|
then
|
||||||
# Print the title of the page
|
# Print the title of the page
|
||||||
local page_title=$(grep "<title>" "$curl_output" | cut --delimiter='>' --fields=2 | cut --delimiter='<' --fields=1)
|
local page_title=$(grep "<title>" "$curl_output" | cut --delimiter='>' --fields=2 | cut --delimiter='<' --fields=1)
|
||||||
local page_extract=$(lynx -dump -force_html "$curl_output" | head --lines 20 | tee -a "$complete_log")
|
local page_extract=$(lynx -dump -force_html "$curl_output" | head --lines 20 | tee -a "$complete_log")
|
||||||
|
|
||||||
# Check if the page title is neither the YunoHost portail or default nginx page
|
# Check if the page title is neither the YunoHost portail or default nginx page
|
||||||
if [ "$page_title" = "YunoHost Portal" ]
|
if [ "$page_title" = "YunoHost Portal" ]
|
||||||
then
|
then
|
||||||
log_debug "The connection attempt fall on the YunoHost portal."
|
log_debug "The connection attempt fall on the YunoHost portal."
|
||||||
fell_on_sso_portal=1
|
fell_on_sso_portal=1
|
||||||
# Falling on nginx default page is an error.
|
# Falling on nginx default page is an error.
|
||||||
elif [ "$page_title" = "Welcome to nginx on Debian!" ]
|
elif [ "$page_title" = "Welcome to nginx on Debian!" ]
|
||||||
then
|
then
|
||||||
log_error "The connection attempt fall on nginx default page."
|
log_error "The connection attempt fall on nginx default page."
|
||||||
|
@ -317,7 +317,7 @@ TEST_INSTALL () {
|
||||||
|
|
||||||
# Install the application in a LXC container
|
# Install the application in a LXC container
|
||||||
INSTALL_APP "path=$check_path" \
|
INSTALL_APP "path=$check_path" \
|
||||||
&& VALIDATE_THAT_APP_CAN_BE_ACCESSED $SUBDOMAIN $check_path
|
&& VALIDATE_THAT_APP_CAN_BE_ACCESSED $SUBDOMAIN $check_path
|
||||||
|
|
||||||
# Check the result and print SUCCESS or FAIL
|
# Check the result and print SUCCESS or FAIL
|
||||||
if [ $? -eq 0 ]
|
if [ $? -eq 0 ]
|
||||||
|
@ -325,17 +325,17 @@ TEST_INSTALL () {
|
||||||
SET_RESULT global_setup 1
|
SET_RESULT global_setup 1
|
||||||
local check_result_setup=1
|
local check_result_setup=1
|
||||||
|
|
||||||
if [ "$install_type" = "root" ]
|
if [ "$install_type" = "root" ]
|
||||||
then
|
then
|
||||||
[ -e "$LXC_SNAPSHOTS/snap_rootinstall" ] \
|
[ -e "$LXC_SNAPSHOTS/snap_rootinstall" ] \
|
||||||
&& log_debug "Create a snapshot for root installation." \
|
&& log_debug "Create a snapshot for root installation." \
|
||||||
&& CREATE_LXC_SNAPSHOT snap_rootinstall
|
&& CREATE_LXC_SNAPSHOT snap_rootinstall
|
||||||
else
|
else
|
||||||
# Check if a snapshot already exist for a subpath (or no_url) install
|
# Check if a snapshot already exist for a subpath (or no_url) install
|
||||||
[ ! -e "$LXC_SNAPSHOTS/snap_subdirinstall" ] \
|
[ ! -e "$LXC_SNAPSHOTS/snap_subdirinstall" ] \
|
||||||
&& log_debug "Create a snapshot for sub path installation." \
|
&& log_debug "Create a snapshot for sub path installation." \
|
||||||
&& CREATE_LXC_SNAPSHOT snap_subdirinstall
|
&& CREATE_LXC_SNAPSHOT snap_subdirinstall
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
SET_RESULT_IF_NONE_YET global_setup -1
|
SET_RESULT_IF_NONE_YET global_setup -1
|
||||||
local check_result_setup=-1
|
local check_result_setup=-1
|
||||||
|
@ -361,7 +361,7 @@ TEST_INSTALL () {
|
||||||
log_small_title "Reinstall the application after a removing."
|
log_small_title "Reinstall the application after a removing."
|
||||||
|
|
||||||
INSTALL_APP "path=$check_path" \
|
INSTALL_APP "path=$check_path" \
|
||||||
&& VALIDATE_THAT_APP_CAN_BE_ACCESSED $SUBDOMAIN $check_path
|
&& VALIDATE_THAT_APP_CAN_BE_ACCESSED $SUBDOMAIN $check_path
|
||||||
|
|
||||||
# Check the result and print SUCCESS or FAIL
|
# Check the result and print SUCCESS or FAIL
|
||||||
[ $? -eq 0 ] && local check_result_setup=1 || local check_result_setup=-1
|
[ $? -eq 0 ] && local check_result_setup=1 || local check_result_setup=-1
|
||||||
|
@ -398,7 +398,7 @@ TEST_UPGRADE () {
|
||||||
start_test "Upgrade from $upgrade_name"
|
start_test "Upgrade from $upgrade_name"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
validate_that_at_least_one_install_succeeded || return
|
validate_that_at_least_one_install_succeeded || return
|
||||||
|
|
||||||
# Install the application in a LXC container
|
# Install the application in a LXC container
|
||||||
log_small_title "Preliminary install..."
|
log_small_title "Preliminary install..."
|
||||||
|
@ -406,7 +406,7 @@ TEST_UPGRADE () {
|
||||||
then
|
then
|
||||||
# If no commit is specified, use the current version.
|
# If no commit is specified, use the current version.
|
||||||
LOAD_SNAPSHOT_OR_INSTALL_APP "$check_path"
|
LOAD_SNAPSHOT_OR_INSTALL_APP "$check_path"
|
||||||
local ret=$?
|
local ret=$?
|
||||||
else
|
else
|
||||||
# Get the arguments of the manifest for this upgrade.
|
# Get the arguments of the manifest for this upgrade.
|
||||||
if [ -n "$specific_upgrade_args" ]; then
|
if [ -n "$specific_upgrade_args" ]; then
|
||||||
|
@ -419,11 +419,11 @@ TEST_UPGRADE () {
|
||||||
sudo cp -a "$package_path" "${package_path}_back"
|
sudo cp -a "$package_path" "${package_path}_back"
|
||||||
(cd "$package_path"; git checkout --force --quiet "$commit")
|
(cd "$package_path"; git checkout --force --quiet "$commit")
|
||||||
|
|
||||||
LOAD_LXC_SNAPSHOT snap0
|
LOAD_LXC_SNAPSHOT snap0
|
||||||
|
|
||||||
# Install the application
|
# Install the application
|
||||||
INSTALL_APP "path=$check_path"
|
INSTALL_APP "path=$check_path"
|
||||||
local ret=$?
|
local ret=$?
|
||||||
|
|
||||||
if [ -n "$specific_upgrade_args" ]; then
|
if [ -n "$specific_upgrade_args" ]; then
|
||||||
mv "$test_serie_dir/install_args.bkp" "$test_serie_dir/install_args"
|
mv "$test_serie_dir/install_args.bkp" "$test_serie_dir/install_args"
|
||||||
|
@ -437,14 +437,14 @@ TEST_UPGRADE () {
|
||||||
# Check if the install had work
|
# Check if the install had work
|
||||||
[ $ret -eq 0 ] || { log_error "Initial install failed... upgrade test ignore"; LXC_STOP; continue; }
|
[ $ret -eq 0 ] || { log_error "Initial install failed... upgrade test ignore"; LXC_STOP; continue; }
|
||||||
|
|
||||||
log_small_title "Upgrade..."
|
log_small_title "Upgrade..."
|
||||||
|
|
||||||
# Upgrade the application in a LXC container
|
# Upgrade the application in a LXC container
|
||||||
RUN_YUNOHOST_CMD "app upgrade $app_id -f ./app_folder/" \
|
RUN_YUNOHOST_CMD "app upgrade $app_id -f ./app_folder/" \
|
||||||
&& VALIDATE_THAT_APP_CAN_BE_ACCESSED $SUBDOMAIN $check_path
|
&& VALIDATE_THAT_APP_CAN_BE_ACCESSED $SUBDOMAIN $check_path
|
||||||
|
|
||||||
if [ $? -eq 0 ]
|
if [ $? -eq 0 ]
|
||||||
then
|
then
|
||||||
SET_RESULT_IF_NONE_YET check_upgrade 1
|
SET_RESULT_IF_NONE_YET check_upgrade 1
|
||||||
else
|
else
|
||||||
SET_RESULT check_upgrade -1
|
SET_RESULT check_upgrade -1
|
||||||
|
@ -468,10 +468,10 @@ TEST_PUBLIC_PRIVATE () {
|
||||||
# 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
|
||||||
local is_public="0"
|
local is_public="0"
|
||||||
local test_name_for_result="check_private"
|
local test_name_for_result="check_private"
|
||||||
elif [ "$install_type" = "public" ]; then
|
elif [ "$install_type" = "public" ]; then
|
||||||
local is_public="1"
|
local is_public="1"
|
||||||
local test_name_for_result="check_private"
|
local test_name_for_result="check_private"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Try in 2 times, first in root and second in sub path.
|
# Try in 2 times, first in root and second in sub path.
|
||||||
|
@ -484,39 +484,39 @@ TEST_PUBLIC_PRIVATE () {
|
||||||
# Check if root installation worked
|
# Check if root installation worked
|
||||||
[ $(GET_RESULT check_root) -eq 1 ] || { log_warning "Root install failed, therefore this test cannot be performed..."; continue; }
|
[ $(GET_RESULT check_root) -eq 1 ] || { log_warning "Root install failed, therefore this test cannot be performed..."; continue; }
|
||||||
|
|
||||||
local check_path=/
|
local check_path=/
|
||||||
|
|
||||||
# Second, try with a sub path install
|
# Second, try with a sub path install
|
||||||
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.
|
||||||
[ $(GET_RESULT check_sub_dir) -eq 1 ] || { log_warning "Sub path install failed, therefore this test cannot be performed..."; continue; }
|
[ $(GET_RESULT check_sub_dir) -eq 1 ] || { log_warning "Sub path install failed, therefore this test cannot be performed..."; continue; }
|
||||||
|
|
||||||
local check_path=/path
|
local check_path=/path
|
||||||
fi
|
fi
|
||||||
|
|
||||||
LOAD_LXC_SNAPSHOT snap0
|
LOAD_LXC_SNAPSHOT snap0
|
||||||
|
|
||||||
# Install the application in a LXC container
|
# Install the application in a LXC container
|
||||||
INSTALL_APP "is_public=$is_public" "path=$check_path" \
|
INSTALL_APP "is_public=$is_public" "path=$check_path" \
|
||||||
&& VALIDATE_THAT_APP_CAN_BE_ACCESSED $SUBDOMAIN $check_path "$install_type"
|
&& VALIDATE_THAT_APP_CAN_BE_ACCESSED $SUBDOMAIN $check_path "$install_type"
|
||||||
|
|
||||||
local ret=$?
|
local ret=$?
|
||||||
|
|
||||||
# Result code = 2 means that we were expecting the app to be public but it's private or viceversa
|
# Result code = 2 means that we were expecting the app to be public but it's private or viceversa
|
||||||
if [ $ret -eq 2 ]
|
if [ $ret -eq 2 ]
|
||||||
then
|
then
|
||||||
yunohost_result=1
|
yunohost_result=1
|
||||||
[ "$install_type" = "private" ] && log_error "App is not private: it should redirect to the Yunohost portal, but is publicly accessible instead"
|
[ "$install_type" = "private" ] && log_error "App is not private: it should redirect to the Yunohost portal, but is publicly accessible instead"
|
||||||
[ "$install_type" = "public" ] && log_error "App page is not public: it should be publicly accessible, but redirects to the Yunohost portal instead"
|
[ "$install_type" = "public" ] && log_error "App page is not public: it should be publicly accessible, but redirects to the Yunohost portal instead"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Check the result and print SUCCESS or FAIL
|
# Check the result and print SUCCESS or FAIL
|
||||||
if [ $ret -eq 0 ]
|
if [ $ret -eq 0 ]
|
||||||
then
|
then
|
||||||
SET_RESULT_IF_NONE_YET $test_name_for_result 1
|
SET_RESULT_IF_NONE_YET $test_name_for_result 1
|
||||||
else
|
else
|
||||||
SET_RESULT $test_name_for_result -1
|
SET_RESULT $test_name_for_result -1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
break_before_continue
|
break_before_continue
|
||||||
|
@ -542,11 +542,11 @@ TEST_MULTI_INSTANCE () {
|
||||||
LOAD_LXC_SNAPSHOT snap0
|
LOAD_LXC_SNAPSHOT snap0
|
||||||
|
|
||||||
log_small_title "First installation: path=$DOMAIN$check_path" \
|
log_small_title "First installation: path=$DOMAIN$check_path" \
|
||||||
&& INSTALL_APP "domain=$DOMAIN" "path=$check_path" \
|
&& INSTALL_APP "domain=$DOMAIN" "path=$check_path" \
|
||||||
&& log_small_title "Second installation: path=$SUBDOMAIN$check_path" \
|
&& log_small_title "Second installation: path=$SUBDOMAIN$check_path" \
|
||||||
&& INSTALL_APP "path=$check_path" \
|
&& INSTALL_APP "path=$check_path" \
|
||||||
&& VALIDATE_THAT_APP_CAN_BE_ACCESSED $DOMAIN $check_path \
|
&& VALIDATE_THAT_APP_CAN_BE_ACCESSED $DOMAIN $check_path \
|
||||||
&& VALIDATE_THAT_APP_CAN_BE_ACCESSED $SUBDOMAIN $check_path "" ${app_id}__2 \
|
&& VALIDATE_THAT_APP_CAN_BE_ACCESSED $SUBDOMAIN $check_path "" ${app_id}__2
|
||||||
|
|
||||||
if [ $? -eq 0 ]
|
if [ $? -eq 0 ]
|
||||||
then
|
then
|
||||||
|
@ -591,7 +591,7 @@ TEST_PORT_ALREADY_USED () {
|
||||||
|
|
||||||
# Install the application in a LXC container
|
# Install the application in a LXC container
|
||||||
INSTALL_APP "path=$check_path" "port=$check_port" \
|
INSTALL_APP "path=$check_path" "port=$check_port" \
|
||||||
&& VALIDATE_THAT_APP_CAN_BE_ACCESSED $SUBDOMAIN $check_path
|
&& VALIDATE_THAT_APP_CAN_BE_ACCESSED $SUBDOMAIN $check_path
|
||||||
|
|
||||||
[ $? -eq 0 ] && SET_RESULT check_port 1 || SET_RESULT check_port -1
|
[ $? -eq 0 ] && SET_RESULT check_port 1 || SET_RESULT check_port -1
|
||||||
|
|
||||||
|
@ -623,7 +623,7 @@ TEST_BACKUP_RESTORE () {
|
||||||
local check_path=/
|
local check_path=/
|
||||||
log_small_title "Preliminary installation on the root..."
|
log_small_title "Preliminary installation on the root..."
|
||||||
|
|
||||||
# Second, try with a sub path install
|
# Second, try with a sub path install
|
||||||
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.
|
||||||
|
@ -657,7 +657,7 @@ TEST_BACKUP_RESTORE () {
|
||||||
|
|
||||||
ret=$?
|
ret=$?
|
||||||
|
|
||||||
if [ $ret -eq 0 ]; then
|
if [ $ret -eq 0 ]; then
|
||||||
log_debug "Backup successful"
|
log_debug "Backup successful"
|
||||||
else
|
else
|
||||||
log_error "Backup failed."
|
log_error "Backup failed."
|
||||||
|
@ -699,14 +699,14 @@ TEST_BACKUP_RESTORE () {
|
||||||
sudo mv -f ./archives $LXC_SNAPSHOTS/snap0/rootfs/home/yunohost.backup/
|
sudo mv -f ./archives $LXC_SNAPSHOTS/snap0/rootfs/home/yunohost.backup/
|
||||||
|
|
||||||
LXC_STOP
|
LXC_STOP
|
||||||
LOAD_LXC_SNAPSHOT snap0
|
LOAD_LXC_SNAPSHOT snap0
|
||||||
|
|
||||||
log_small_title "Restore on a clean YunoHost system..."
|
log_small_title "Restore on a clean YunoHost system..."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Restore the application from the previous backup
|
# Restore the application from the previous backup
|
||||||
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
|
||||||
|
|
||||||
local ret=$?
|
local ret=$?
|
||||||
|
|
||||||
|
@ -747,37 +747,37 @@ TEST_CHANGE_URL () {
|
||||||
local new_path=/path
|
local new_path=/path
|
||||||
local new_domain=$SUBDOMAIN
|
local new_domain=$SUBDOMAIN
|
||||||
|
|
||||||
# Same domain, path to path
|
# Same domain, path to path
|
||||||
elif [ $i -eq 2 ]; then
|
elif [ $i -eq 2 ]; then
|
||||||
check_path=/path
|
check_path=/path
|
||||||
local new_path=/path_2
|
local new_path=/path_2
|
||||||
local new_domain=$SUBDOMAIN
|
local new_domain=$SUBDOMAIN
|
||||||
|
|
||||||
# Same domain, path to root
|
# Same domain, path to root
|
||||||
elif [ $i -eq 3 ]; then
|
elif [ $i -eq 3 ]; then
|
||||||
check_path=/path
|
check_path=/path
|
||||||
local new_path=/
|
local new_path=/
|
||||||
local new_domain=$SUBDOMAIN
|
local new_domain=$SUBDOMAIN
|
||||||
|
|
||||||
# Other domain, root to path
|
# Other domain, root to path
|
||||||
elif [ $i -eq 4 ]; then
|
elif [ $i -eq 4 ]; then
|
||||||
check_path=/
|
check_path=/
|
||||||
local new_path=/path
|
local new_path=/path
|
||||||
local new_domain=$DOMAIN
|
local new_domain=$DOMAIN
|
||||||
|
|
||||||
# Other domain, path to path
|
# Other domain, path to path
|
||||||
elif [ $i -eq 5 ]; then
|
elif [ $i -eq 5 ]; then
|
||||||
check_path=/path
|
check_path=/path
|
||||||
local new_path=/path_2
|
local new_path=/path_2
|
||||||
local new_domain=$DOMAIN
|
local new_domain=$DOMAIN
|
||||||
|
|
||||||
# Other domain, path to root
|
# Other domain, path to root
|
||||||
elif [ $i -eq 6 ]; then
|
elif [ $i -eq 6 ]; then
|
||||||
check_path=/path
|
check_path=/path
|
||||||
local new_path=/
|
local new_path=/
|
||||||
local new_domain=$DOMAIN
|
local new_domain=$DOMAIN
|
||||||
|
|
||||||
# Other domain, root to root
|
# Other domain, root to root
|
||||||
elif [ $i -eq 7 ]; then
|
elif [ $i -eq 7 ]; then
|
||||||
check_path=/
|
check_path=/
|
||||||
local new_path=/
|
local new_path=/
|
||||||
|
@ -786,20 +786,20 @@ TEST_CHANGE_URL () {
|
||||||
|
|
||||||
# Validate that install worked in the corresponding configuration previously
|
# Validate that install worked in the corresponding configuration previously
|
||||||
|
|
||||||
# If any of the begin/end path is /, we need to have root install working
|
# If any of the begin/end path is /, we need to have root install working
|
||||||
( [ "$check_path" != "/" ] && [ "$new_path" != "/" ] ) || [ $(GET_RESULT check_root) -eq 1 ] \
|
( [ "$check_path" != "/" ] && [ "$new_path" != "/" ] ) || [ $(GET_RESULT check_root) -eq 1 ] \
|
||||||
|| { log_warning "Root install failed, therefore this test cannot be performed..."; continue; }
|
|| { log_warning "Root install failed, therefore this test cannot be performed..."; continue; }
|
||||||
|
|
||||||
# If any of the being/end path is not /, we need to have sub_dir install working
|
# If any of the being/end path is not /, we need to have sub_dir install working
|
||||||
( [ "$new_path" == "/" ] && [ "$new_path" == "/" ] ) || [ $(GET_RESULT check_sub_dir) -eq 1 ] \
|
( [ "$new_path" == "/" ] && [ "$new_path" == "/" ] ) || [ $(GET_RESULT check_sub_dir) -eq 1 ] \
|
||||||
|| { log_warning "Subpath install failed, therefore this test cannot be performed..."; continue; }
|
|| { log_warning "Subpath install failed, therefore this test cannot be performed..."; continue; }
|
||||||
|
|
||||||
# Install the application in a LXC container
|
# Install the application in a LXC container
|
||||||
log_small_title "Preliminary install..." \
|
log_small_title "Preliminary install..." \
|
||||||
&& LOAD_SNAPSHOT_OR_INSTALL_APP "$check_path" \
|
&& LOAD_SNAPSHOT_OR_INSTALL_APP "$check_path" \
|
||||||
&& log_small_title "Change the url from $SUBDOMAIN$check_path to $new_domain$new_path..." \
|
&& log_small_title "Change the url from $SUBDOMAIN$check_path to $new_domain$new_path..." \
|
||||||
&& RUN_YUNOHOST_CMD "app change-url $app_id -d '$new_domain' -p '$new_path'" \
|
&& RUN_YUNOHOST_CMD "app change-url $app_id -d '$new_domain' -p '$new_path'" \
|
||||||
&& VALIDATE_THAT_APP_CAN_BE_ACCESSED $new_domain $new_path
|
&& VALIDATE_THAT_APP_CAN_BE_ACCESSED $new_domain $new_path
|
||||||
|
|
||||||
if [ $ret -eq 0 ]
|
if [ $ret -eq 0 ]
|
||||||
then
|
then
|
||||||
|
@ -930,7 +930,7 @@ ACTIONS_CONFIG_PANEL () {
|
||||||
|
|
||||||
# Show the config-panel
|
# Show the config-panel
|
||||||
RUN_YUNOHOST_CMD "app config show-panel $app_id"
|
RUN_YUNOHOST_CMD "app config show-panel $app_id"
|
||||||
local ret=$?
|
local ret=$?
|
||||||
|
|
||||||
validate_action_config_panel "yunohost app config show-panel"
|
validate_action_config_panel "yunohost app config show-panel"
|
||||||
fi
|
fi
|
||||||
|
@ -1096,12 +1096,12 @@ ACTIONS_CONFIG_PANEL () {
|
||||||
then
|
then
|
||||||
# Aply a configuration
|
# Aply a configuration
|
||||||
RUN_YUNOHOST_CMD "app config apply $app_id $action_config_action $action_config_argument_built"
|
RUN_YUNOHOST_CMD "app config apply $app_id $action_config_action $action_config_argument_built"
|
||||||
ret=$?
|
ret=$?
|
||||||
elif [ "$test_type" == "actions" ]
|
elif [ "$test_type" == "actions" ]
|
||||||
then
|
then
|
||||||
# Execute an action
|
# Execute an action
|
||||||
RUN_YUNOHOST_CMD "app action run $app_id $action_config_action $action_config_argument_built"
|
RUN_YUNOHOST_CMD "app action run $app_id $action_config_action $action_config_argument_built"
|
||||||
ret=$?
|
ret=$?
|
||||||
fi
|
fi
|
||||||
validate_action_config_panel "yunohost action $action_config_action"
|
validate_action_config_panel "yunohost action $action_config_action"
|
||||||
done
|
done
|
||||||
|
@ -1235,7 +1235,7 @@ check_witness_files () {
|
||||||
check_file_exist "/etc/nginx/conf.d/$DOMAIN.d/witnessfile.conf"
|
check_file_exist "/etc/nginx/conf.d/$DOMAIN.d/witnessfile.conf"
|
||||||
check_file_exist "/etc/nginx/conf.d/$SUBDOMAIN.d/witnessfile.conf"
|
check_file_exist "/etc/nginx/conf.d/$SUBDOMAIN.d/witnessfile.conf"
|
||||||
|
|
||||||
# /etc
|
# /etc
|
||||||
check_file_exist "/etc/witnessfile"
|
check_file_exist "/etc/witnessfile"
|
||||||
|
|
||||||
# /opt directory
|
# /opt directory
|
||||||
|
|
Loading…
Add table
Reference in a new issue