diff --git a/scripts/_common.sh b/scripts/_common.sh index 7849e16..d271360 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -14,29 +14,3 @@ _validate_redirect_uri() { ynh_die --message="For secure reason, you can't use an unencrypted http remote destination couple with ssowat for your reverse proxy: $target" 1 fi } - -_add_dummy_service() { - cat << EOF > /etc/systemd/system/whatever.service -[Unit] -Description=Whatever -After=network.target - -[Service] -WorkingDirectory=/redirect/ -ExecStart=python3 -m http.server -b 127.0.0.1 1234 -PrivateTmp=true - -[Install] -WantedBy=multi-user.target -EOF - - mkdir -p /redirect - mkdir -p /redirect/path - echo "helloworld" > /redirect/index.html - echo "helloworld" > /redirect/path/index.html - systemctl daemon-reload - ynh_systemd_action --service_name=whatever --action=enable - ynh_systemd_action --service_name=whatever --action=restart - - true -} diff --git a/scripts/install b/scripts/install index 4e7432c..351e62d 100644 --- a/scripts/install +++ b/scripts/install @@ -11,12 +11,6 @@ source /usr/share/yunohost/helpers _validate_redirect_uri -# When testing on the CI, we need a service to test the reverse-proxying -if [[ ${PACKAGE_CHECK_EXEC} == "1" ]] && [[ "$redirect_type" == "reverseproxy" ]] -then - _add_dummy_service -fi - #================================================= # CONFIGURE NGINX #================================================= diff --git a/scripts/restore b/scripts/restore index 926294b..060d0d0 100644 --- a/scripts/restore +++ b/scripts/restore @@ -8,12 +8,6 @@ ynh_restore_file --origin_path="/etc/nginx/conf.d/${domain}.d/${app}.conf" ynh_script_progression --message="Reloading NGINX web server..." --weight=1 ynh_systemd_action --service_name=nginx --action=reload -# When testing on the CI, we need a service to test the reverse-proxying -if [[ ${PACKAGE_CHECK_EXEC} == "1" ]] && [[ "$redirect_type" == "reverseproxy" ]] -then - _add_dummy_service -fi - #================================================= # END OF SCRIPT #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 52b7cad..3420a87 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -20,12 +20,6 @@ if [[ -z "${target:-}" ]] && [[ -n "${redirect_path:-}" ]]; then ynh_app_setting_set --app=$app --key=target --value="$target" fi -# When testing on the CI, we need a service to test the reverse-proxying -if [[ ${PACKAGE_CHECK_EXEC} == "1" ]] && [[ "$redirect_type" == "reverseproxy" ]] -then - _add_dummy_service -fi - #================================================= # CONFIGURE NGINX #================================================= diff --git a/tests.toml b/tests.toml index e1c4173..86d54c9 100644 --- a/tests.toml +++ b/tests.toml @@ -25,6 +25,55 @@ test_format = 1.0 exclude = ["install.private", "install.multi", "backup_restore", "change_url"] + preinstall = """ + cat << EOF > /etc/systemd/system/whatever.service +[Unit] +Description=Whatever +After=network.target + +[Service] +WorkingDirectory=/redirect/ +ExecStart=python3 -m http.server -b 127.0.0.1 1234 +PrivateTmp=true + +[Install] +WantedBy=multi-user.target +EOF + + mkdir -p /redirect + mkdir -p /redirect/path + echo "helloworld" > /redirect/index.html + echo "helloworld" > /redirect/path/index.html + systemctl daemon-reload + ynh_systemd_action --service_name=whatever --action=enable + ynh_systemd_action --service_name=whatever --action=restart + true +""" + preupgrade = """ + cat << EOF > /etc/systemd/system/whatever.service +[Unit] +Description=Whatever +After=network.target + +[Service] +WorkingDirectory=/redirect/ +ExecStart=python3 -m http.server -b 127.0.0.1 1234 +PrivateTmp=true + +[Install] +WantedBy=multi-user.target +EOF + + mkdir -p /redirect + mkdir -p /redirect/path + echo "helloworld" > /redirect/index.html + echo "helloworld" > /redirect/path/index.html + systemctl daemon-reload + ynh_systemd_action --service_name=whatever --action=enable + ynh_systemd_action --service_name=whatever --action=restart + true +""" + [reverseproxy.test_upgrade_from.09cf1c6b] name = "v1 era" args.domain = "domain.tld"