mirror of
https://github.com/YunoHost-Apps/redirect_ynh.git
synced 2024-09-03 20:16:10 +02:00
Attempt to move the dummy service setup to preinstall/preupgrade instructions in tests.toml, avoid poluting the actual scripts
This commit is contained in:
parent
2684e51427
commit
e931634e46
5 changed files with 49 additions and 44 deletions
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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
|
||||
#=================================================
|
||||
|
|
|
@ -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
|
||||
#=================================================
|
||||
|
|
|
@ -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
|
||||
#=================================================
|
||||
|
|
49
tests.toml
49
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"
|
||||
|
|
Loading…
Add table
Reference in a new issue