From 6230e155afd8c43c12ee3f03032aac34433db11a Mon Sep 17 00:00:00 2001 From: Christopher Baines Date: Sat, 5 Aug 2017 22:32:24 +0100 Subject: gnu: Fix memcached service startup. Memcached changes to the memcached user from root before writing the PID file. This means that it must be able to write the PID file as the memcached user. To make this work, create the /var/run/memcached directory when the service starts, make it owned by memcached, and change memcached to write the PID file to /var/run/memcached/pid. This wasn't picked up by the system test as the "service running" part was too permissive, and only failed on an error. Instead, test the response from calling start-service and check that the PID is a number. * gnu/services/databases.scm (memcached-activation): New variable. (memcached-shepherd-service): Change PID file location. (memcached-service-type): Extend the activation-service-type. * gnu/tests/databases.scm (run-memcached-test)[test]: Change the "service running" test to check the response from the shepherd. --- gnu/tests/databases.scm | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'gnu/tests') diff --git a/gnu/tests/databases.scm b/gnu/tests/databases.scm index 310210c368..9d9a753747 100644 --- a/gnu/tests/databases.scm +++ b/gnu/tests/databases.scm @@ -63,13 +63,15 @@ (test-begin "memcached") ;; Wait for memcached to be up and running. - (test-eq "service running" - 'running! + (test-assert "service running" (marionette-eval '(begin (use-modules (gnu services herd)) - (start-service 'memcached) - 'running!) + (match (start-service 'memcached) + (#f #f) + (('service response-parts ...) + (match (assq-ref response-parts 'running) + ((pid) (number? pid)))))) marionette)) (let* ((ai (car (getaddrinfo "localhost" -- cgit v1.2.3