summaryrefslogtreecommitdiffstats
path: root/debian/tests/htcacheclean
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-07 02:04:07 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-07 02:04:07 +0000
commit1221c736f9a90756d47ea6d28320b6b83602dd2a (patch)
treeb453ba7b1393205258c9b098a773b4330984672f /debian/tests/htcacheclean
parentAdding upstream version 2.4.38. (diff)
downloadapache2-debian/2.4.38-3+deb10u8.tar.xz
apache2-debian/2.4.38-3+deb10u8.zip
Adding debian version 2.4.38-3+deb10u8.debian/2.4.38-3+deb10u8
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'debian/tests/htcacheclean')
-rw-r--r--debian/tests/htcacheclean70
1 files changed, 70 insertions, 0 deletions
diff --git a/debian/tests/htcacheclean b/debian/tests/htcacheclean
new file mode 100644
index 0000000..90c721f
--- /dev/null
+++ b/debian/tests/htcacheclean
@@ -0,0 +1,70 @@
+#!/bin/sh
+set -exu
+
+fatal () {
+ echo "ERROR: $@" >&2
+ exit 1
+}
+
+skip () {
+ echo "ERROR: $@" >&2
+ exit 77
+}
+
+htc_enabled () {
+ if ls /etc/rc[2345].d/S*apache-htcacheclean > /dev/null 2>&1 ; then
+ return 0
+ else
+ return 1
+ fi
+}
+
+if htc_enabled ; then
+ fatal "apache-htcacheclean should not be enabled"
+fi
+
+a2enmod cache_disk
+
+if ! htc_enabled ; then
+ fatal "apache-htcacheclean should be enabled"
+fi
+
+service apache-htcacheclean start
+
+# for debugging
+ps -ef|grep /usr/bin/htcacheclean || true
+
+PGREP="pgrep -P 1 -u www-data -G www-data htcacheclean"
+
+if ! $PGREP ; then
+ fatal "htcacheclean is not running or running as wrong user/group"
+fi
+
+if ! service apache-htcacheclean status ; then
+ fatal "status did not return 'running'"
+fi
+
+service apache-htcacheclean stop
+sleep 1
+
+if $PGREP ; then
+ skip "htcacheclean did not stop"
+fi
+
+if service apache-htcacheclean status ; then
+ fatal "status did not return 'stopped'"
+fi
+
+a2dismod cache_disk
+
+if htc_enabled ; then
+ fatal "apache-htcacheclean should not be enabled"
+fi
+
+a2enmod cache_socache
+
+if htc_enabled ; then
+ fatal "apache-htcacheclean has been enabled for cache_socache"
+fi
+
+exit 0