From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52633) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fcWua-0001B1-74 for guix-patches@gnu.org; Mon, 09 Jul 2018 10:13:09 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fcWuV-0007Pf-EJ for guix-patches@gnu.org; Mon, 09 Jul 2018 10:13:08 -0400 Received: from debbugs.gnu.org ([208.118.235.43]:44638) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fcWuV-0007Pb-97 for guix-patches@gnu.org; Mon, 09 Jul 2018 10:13:03 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1fcWuV-0005Gk-1b for guix-patches@gnu.org; Mon, 09 Jul 2018 10:13:03 -0400 Subject: [bug#31911] services: Add prometheus-node-exporter-service-type. Resent-Message-ID: MIME-Version: 1.0 References: <20180620125946.7264-1-boskovits@gmail.com> <87sh4s93ai.fsf@lassieur.org> In-Reply-To: <87sh4s93ai.fsf@lassieur.org> From: =?UTF-8?Q?G=C3=A1bor?= Boskovits Date: Mon, 9 Jul 2018 16:12:37 +0200 Message-ID: Content-Type: multipart/alternative; boundary="000000000000ba9bd70570919b81" List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+kyle=kyleam.com@gnu.org Sender: "Guix-patches" To: =?UTF-8?Q?Cl=C3=A9ment?= Lassieur Cc: 31911-done@debbugs.gnu.org --000000000000ba9bd70570919b81 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Cl=C3=A9ment Lassieur ezt =C3=ADrta (id=C5=91pont: 2= 018. j=C3=BAl. 9., H, 11:17): > Hi G=C3=A1bor, > > G=C3=A1bor Boskovits 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? > Cl=C3=A9ment > --000000000000ba9bd70570919b81 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
=
Hi G=C3=A1bor,

G=C3=A1bor Boskovits <
boskovits@gmail.com> writes:

> Pushed to master as a33652ee336ae9a5d2ab5fd54bf2397caec42a0e.

> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (test-assert "prometheus-node= -exporter running"
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (marionette-eval
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0'(begin
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (use-modules = (gnu services herd))
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (match (start= -service 'prometheus-node-exporter)
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (#f #f= )
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (('= ;service response-parts ...)
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= (match (assq-ref response-parts 'running)
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0((pid) (number? pid))))))
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0marionette))

The PID check is useless because START-SERVICE will return #f if the
service fails to start.=C2=A0 Instead, I'd use:

=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (test-assert "prometheus-node-expor= ter running"
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (marionette-eval
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0'(begin
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (use-modules (gnu s= ervices herd))
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (start-service '= ;prometheus-node-exporter))
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0marionette))

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. Inc= identally the code is almost the same as in hpcguix-web test. Should we als= o adjust that?
=C2=A0
Cl=C3=A9ment
--000000000000ba9bd70570919b81--