all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: ludo@gnu.org (Ludovic Courtès)
To: Christopher Baines <mail@cbaines.net>
Cc: 27650@debbugs.gnu.org
Subject: [bug#27650] [PATCH 2/2] tests: Add 'tailon-service-type' test.
Date: Wed, 26 Jul 2017 22:46:37 +0200	[thread overview]
Message-ID: <87379j7wpe.fsf@gnu.org> (raw)
In-Reply-To: <20170726090853.8987-2-mail@cbaines.net> (Christopher Baines's message of "Wed, 26 Jul 2017 10:08:53 +0100")

Christopher Baines <mail@cbaines.net> skribis:

> * gnu/local.mk (GNU_SYSTEM_MODULES): Add it.
> * gnu/tests/web.scm: New file.

[...]

> +(define* (run-tailon-test #:optional (http-port 8081))
> +  "Run tests in %TAILON-OS, which has tailon running and listening on
> +HTTP-PORT."
> +  (mlet* %store-monad ((os ->   (marionette-operating-system
> +                                 %tailon-os
> +                                 #:imported-modules '((gnu services herd)
> +                                                      (guix combinators))))
> +                       (command (system-qemu-image/shared-store-script
> +                                 os #:graphic? #f)))


[...]

> +            (define marionette
> +              ;; Forward the guest's HTTP-PORT, where tailon is listening, to
> +              ;; port 8080 in the host.
> +              (make-marionette (list #$command "-net"
> +                                     #$(simple-format
> +                                        #f
> +                                        "user,hostfwd=tcp::~A-:8080"
> +                                        http-port))))

This can be simplified using the new ‘virtual-machine’ objects:

   https://debbugs.gnu.org/cgi/bugreport.cgi?bug=27751

Could you give it a try?

> +            (test-equal "http-get"
> +              200
> +              (let-values (((response text)
> +                            (http-get #$(simple-format
> +                                         #f
> +                                         "http://localhost:~A/"
> +                                         http-port)
> +                                      #:decode-body? #t)))
> +                (response-code response)))

If there was a more specific API, like a rest API to check whether a
specific log file exists, perhaps that’d be a good extra test.
Otherwise that’s fine.

BTW, it’s enough to use ‘format’ rather than ‘simple-format’ here: it’s
(roughly) equivalent and incurs less typing.  :-)

Feel free to squeeze this patch with the previous one (thus making a
self-contained commit), or leave it separately if it’s more convenient
for you.

Thanks for taking the time to write this test!

Ludo’.

  reply	other threads:[~2017-07-26 20:47 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-11  6:56 [bug#27650] [PATCH] gnu: services: admin: Add tailon Christopher Baines
2017-07-12 12:13 ` Ludovic Courtès
2017-07-16 15:51   ` Christopher Baines
2017-07-17  8:40     ` Ludovic Courtès
2017-07-16 15:52   ` Christopher Baines
2017-07-17  9:52     ` Ludovic Courtès
2017-07-26  9:50       ` Christopher Baines
2017-07-16 15:58   ` [bug#27650] [PATCH] tests: Add 'tailon-service-type' test Christopher Baines
2017-07-17  9:53     ` Ludovic Courtès
2017-07-26  9:08 ` [bug#27650] [PATCH 1/2] gnu: services: admin: Add tailon Christopher Baines
2017-07-26  9:08   ` [bug#27650] [PATCH 2/2] tests: Add 'tailon-service-type' test Christopher Baines
2017-07-26 20:46     ` Ludovic Courtès [this message]
2017-07-27 17:33       ` Christopher Baines
2017-07-27 17:35       ` [bug#27650] [PATCH] gnu: services: admin: Add tailon Christopher Baines
2017-07-28 19:36         ` Ludovic Courtès
2017-07-28 21:00           ` Christopher Baines
2017-07-29 12:00             ` bug#27650: " Christopher Baines
2017-07-29 12:10             ` [bug#27650] " Ludovic Courtès
2017-07-26 20:40   ` [bug#27650] [PATCH 1/2] " Ludovic Courtès

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87379j7wpe.fsf@gnu.org \
    --to=ludo@gnu.org \
    --cc=27650@debbugs.gnu.org \
    --cc=mail@cbaines.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.