From f19ece34db0d9a03850aacb69e4bf4b8e6e47d18 Mon Sep 17 00:00:00 2001 From: Colin Hutchinson Date: Fri, 7 Feb 2020 09:48:04 -0500 Subject: [PATCH] fix(systemctl) fixes systemctl reload kong.service (#216) * test(systemctl) test all systemctl actions * fix(systemctl) fix systemctl reload kong command --- kong.service | 2 +- test/run_tests.sh | 2 ++ test/tests/01-package/run.sh | 15 ++++++++++++++- 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/kong.service b/kong.service index 48608446ef86..7dc6d619b877 100644 --- a/kong.service +++ b/kong.service @@ -6,7 +6,7 @@ After=syslog.target network.target remote-fs.target nss-lookup.target [Service] ExecStartPre=/usr/local/bin/kong prepare -p /usr/local/kong ExecStart=/usr/local/openresty/nginx/sbin/nginx -p /usr/local/kong -c nginx.conf -ExecReload=/usr/local/openresty/nginx/sbin/nginx -s reload +ExecReload=/usr/local/openresty/nginx/sbin/nginx -p /usr/local/kong -c nginx.conf -s reload ExecStop=/bin/kill -s QUIT $MAINPID PrivateTmp=true diff --git a/test/run_tests.sh b/test/run_tests.sh index 7db01111fac5..a27d5306a285 100755 --- a/test/run_tests.sh +++ b/test/run_tests.sh @@ -1,5 +1,7 @@ #!/bin/bash +set -x + source test/util.sh if $VERBOSE; then diff --git a/test/tests/01-package/run.sh b/test/tests/01-package/run.sh index a3f6eb843dc0..4a11c8cd2ed8 100644 --- a/test/tests/01-package/run.sh +++ b/test/tests/01-package/run.sh @@ -20,11 +20,24 @@ docker run ${USE_TTY} --user=root --rm ${KONG_TEST_IMAGE_NAME} /bin/sh -c "ls -l # TODO enable this test in other distros containing systemd if [[ "$RESTY_IMAGE_TAG" == "bionic" ]]; then cp $PACKAGE_LOCATION/*.deb kong.deb - docker run -d --rm --name systemd-ubuntu --privileged -v /sys/fs/cgroup:/sys/fs/cgroup:ro -v $PWD:/src jrei/systemd-ubuntu + docker run -d --rm --name systemd-ubuntu -e KONG_DATABASE=off --privileged -v /sys/fs/cgroup:/sys/fs/cgroup:ro -v $PWD:/src jrei/systemd-ubuntu docker exec ${USE_TTY} systemd-ubuntu /bin/bash -c "dpkg -i /src/kong.deb || true" docker exec ${USE_TTY} systemd-ubuntu /bin/bash -c "apt-get update" docker exec ${USE_TTY} systemd-ubuntu /bin/bash -c "apt-get install -f -y" + docker exec ${USE_TTY} systemd-ubuntu /bin/bash -c "mkdir -p /etc/systemd/system/kong.service.d/" + docker exec ${USE_TTY} systemd-ubuntu /bin/bash -c "cat <<\EOD > /etc/systemd/system/kong.service.d/override.conf +[Service] +Environment=KONG_DATABASE=off +EOD" + docker exec ${USE_TTY} systemd-ubuntu /bin/bash -c "systemctl daemon-reload" + sleep 5 docker exec ${USE_TTY} systemd-ubuntu /bin/bash -c "systemctl start kong" + sleep 5 + docker exec ${USE_TTY} systemd-ubuntu /bin/bash -c "systemctl reload kong" + sleep 5 + docker exec ${USE_TTY} systemd-ubuntu /bin/bash -c "systemctl restart kong" + sleep 5 + docker exec ${USE_TTY} systemd-ubuntu /bin/bash -c "systemctl stop kong" docker stop systemd-ubuntu rm kong.deb fi