chiark / gitweb /
autopkgtests: Break out test-service-startup-main
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 1 Mar 2026 15:36:20 +0000 (15:36 +0000)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 1 Mar 2026 15:36:58 +0000 (15:36 +0000)
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
adt/acommon
adt/adt-initscript

index b0edb5d09558bc7b9b37e617c73d733d79a57c8f..c1da88e0fd6f3d6aaa0c20f6eee833b209a35579 100644 (file)
@@ -50,6 +50,25 @@ test-service-startup-prep () {
 END
 }
 
+test-service-startup-main () {
+    # Test that hippotatd was started, and that we can restart and stop it
+
+    curl http://localhost:8099/ | tee /dev/stderr | grep hippotat
+
+    dpid=$(pidof hippotatd)
+
+    service hippotatd restart
+
+    dpid2=$(pidof hippotatd)
+
+    test $dpid != $dpid2
+
+    service hippotatd stop
+
+    ( LC_MESSAGES=C nc -v localhost 8099 2>&1 ||: ) \
+       | tee /dev/stderr | grep 'Connection refused'
+}
+
 filesystem-prep () {
     cs=$1; shift
     # expects $tmp to be set to test-specific temp dir (abs path)
index 0bf60a042e49fc407936c5b1e10014e9a5703066..836151dc9b8a3da3fa7cfcc8a353709a13426cbc 100755 (executable)
@@ -18,19 +18,6 @@ test-service-startup-prep
 # any formal documentation of it.  Instead, "restart" ought to DTRT.
 service hippotatd restart
 
-curl http://localhost:8099/ | tee /dev/stderr | grep hippotat
-
-dpid=$(pidof hippotatd)
-
-service hippotatd restart
-
-dpid2=$(pidof hippotatd)
-
-test $dpid != $dpid2
-
-service hippotatd stop
-
-( LC_MESSAGES=C nc -v localhost 8099 2>&1 ||: ) \
-    | tee /dev/stderr | grep 'Connection refused'
+test-service-startup-main
 
 t-ok