Subject: Re: bug#31911: services: Add prometheus-node-exporter-service-type.

From: Clément Lassieur <[email-masked]>
Date: Mon, 09 Jul 2018 16:21:44 +0200

Gábor Boskovits <[email-masked]> writes:

> Clément Lassieur <[email-masked]> ezt írta (időpont: 2018. júl. 9.,
> H, 11:17):
>
>> Hi Gábor,
>>
>> Gábor Boskovits <[email-masked]> writes:
>>
>> > Pushed to master as a33652ee336ae9a5d2ab5fd54bf2397caec42a0e.
>>
>> > +          (test-assert "prometheus-node-exporter running"
>> > +            (marionette-eval
>> > +             '(begin
>> > +                (use-modules (gnu services herd))
>> > +                (match (start-service 'prometheus-node-exporter)
>> > +                  (#f #f)
>> > +                  (('service response-parts ...)
>> > +                   (match (assq-ref response-parts 'running)
>> > +                     ((pid) (number? pid))))))
>> > +             marionette))
>>
>> The PID check is useless because START-SERVICE will return #f if the
>> service fails to start.  Instead, I'd use:
>>
>>           (test-assert "prometheus-node-exporter running"
>>             (marionette-eval
>>              '(begin
>>                 (use-modules (gnu services herd))
>>                 (start-service 'prometheus-node-exporter))
>>              marionette))
>>
>> This would also make the test more robust to service changes (e.g. it
>> would still work if MAKE-FORKEXEC-CONSTRUCTOR is removed).
>>
>>
> Thanks, I will adjust accordingly. Incidentally the code is almost the same
> as in hpcguix-web test. Should we also adjust that?

You're welcome :-)  It's not urgent, but in the long term, it would be
good that all similar code is ajusted accordingly.  It's in lots of
other places as well if I remember well.