Subject: bug#54786: Installation tests are failing

From: Ludovic Courtès <[email-masked]>
Date: Sat, 28 May 2022 23:29:54 +0200

Hi Maxim,

Maxim Cournoyer <[email-masked]> skribis:

> Ludovic Courtès <[email-masked]> writes:
>
>> Hi,
>>
>> Mathieu Othacehe <[email-masked]> skribis:
>>
>>> Thanks for the fix! The jami and jami-provisioning tests are also broken
>>> because of what looks like to be the same issue:
>>>
>>> One does not simply initialize the client: Another daemon is detected
>>> /gnu/store/01phrvxnxrg1q0gxa35g7f77q06crf6v-shepherd-marionette.scm:1:1718: ERROR:
>>>   1. &action-exception-error:
>>>       service: jami
>>>       action: start
>>>       key: match-error
>>>       args: ("match" "no matching pattern" #f)
>>> Jami Daemon 11.0.0, by Savoir-faire Linux 2004-2019
>>> https://jami.net/
>>> [Video support enabled]
>>> [Plugins support enabled]
>>
>> Yes, I noticed that, but I’m not sure how to apply a similar workaround.
>
> I tried fixing that today, but so far I've only managed to understand
> what seems to be going wrong, with this (not so great) workflow:

While working on <https://issues.guix.gnu.org/55444>, I figured
‘wait-for-service’ could be useful for system tests that were previously
using ‘start-service’ as a way to wait for a service to be up and
running.

I tried the following change, which should be semantically equivalent to
what was happening with the Shepherd 0.8.  However, it doesn’t seem to
work, for reasons that escape me.

Thoughts?

Ludo’.

diff --git a/gnu/tests/telephony.scm b/gnu/tests/telephony.scm
index bc464a431a..c219868859 100644
--- a/gnu/tests/telephony.scm
+++ b/gnu/tests/telephony.scm
@@ -145,11 +145,7 @@ (define marionette
             (marionette-eval
              '(begin
                 (use-modules (gnu services herd))
-                (match (start-service 'jami)
-                  (#f #f)
-                  (('service response-parts ...)
-                   (match (assq-ref response-parts 'running)
-                     ((pid) (number? pid))))))
+                (wait-for-service 'jami #:timeout 60))
              marionette))
 
           (test-assert "service can be stopped"
@@ -158,12 +154,7 @@ (define marionette
                 (use-modules (gnu services herd)
                              (rnrs base))
                 (setenv "PATH" "/run/current-system/profile/bin")
-                (let ((pid (match (start-service 'jami)
-                             (#f #f)
-                             (('service response-parts ...)
-                              (match (assq-ref response-parts 'running)
-                                ((pid) pid))))))
-
+                (let ((pid (wait-for-service 'jami)))
                   (assert (number? pid))
 
                   (match (stop-service 'jami)
@@ -193,14 +184,10 @@ (define pid (match (start-service 'jami)
                 ;; Restart the service.
                 (restart-service 'jami)
 
-                (define new-pid (match (start-service 'jami)
-                                  (#f #f)
-                                  (('service response-parts ...)
-                                   (match (assq-ref response-parts 'running)
-                                     ((pid) pid)))))
+                (define new-pid (wait-for-service 'jami))
                 (assert (number? new-pid))
 
-                (not (eq? pid new-pid)))
+                (not (= pid new-pid)))
              marionette))
 
           (unless #$provisioning? (test-skip 1))