unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: Christopher Baines <mail@cbaines.net>
To: "Ludovic Courtès" <ludo@gnu.org>
Cc: 27650@debbugs.gnu.org
Subject: [bug#27650] [PATCH 2/2] tests: Add 'tailon-service-type' test.
Date: Thu, 27 Jul 2017 18:33:26 +0100	[thread overview]
Message-ID: <20170727183326.23045a4a@cbaines.net> (raw)
In-Reply-To: <87379j7wpe.fsf@gnu.org>

[-- Attachment #1: Type: text/plain, Size: 3083 bytes --]

On Wed, 26 Jul 2017 22:46:37 +0200
ludo@gnu.org (Ludovic Courtès) wrote:

> 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?

Yep, I'll send an updated patch that switches to use this approach.

> > +            (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.

I'm not sure there is an API, but I'll have a think about more useful
testing approaches. Maybe checking for things in the response, or
trying to run Tailon's test suite...

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

Ok, I'll change to use format.

> 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.

Squashing them is fine, I'll do this.

> Thanks for taking the time to write this test!

No problem, thanks for your and everyone elses advice on QEMU on IRC,
it was very useful.

Also, I've removed the sleep, and replaced it with a function to retry
the connection on error, which should hopefully avoid any issues with
it failing just because Tailon hasn't finished starting yet.

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 963 bytes --]

  reply	other threads:[~2017-07-27 17:34 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
2017-07-27 17:33       ` Christopher Baines [this message]
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

  List information: https://guix.gnu.org/

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

  git send-email \
    --in-reply-to=20170727183326.23045a4a@cbaines.net \
    --to=mail@cbaines.net \
    --cc=27650@debbugs.gnu.org \
    --cc=ludo@gnu.org \
    /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 public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).