[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug#27650] [PATCH 2/2] tests: Add 'tailon-service-type' test.
From: |
Ludovic Courtès |
Subject: |
[bug#27650] [PATCH 2/2] tests: Add 'tailon-service-type' test. |
Date: |
Wed, 26 Jul 2017 22:46:37 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux) |
Christopher Baines <address@hidden> 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’.
- [bug#27650] [PATCH] gnu: services: admin: Add tailon., (continued)
- [bug#27650] [PATCH 1/2] gnu: services: admin: Add tailon., Christopher Baines, 2017/07/26
- [bug#27650] [PATCH 2/2] tests: Add 'tailon-service-type' test., Christopher Baines, 2017/07/26
- [bug#27650] [PATCH 2/2] tests: Add 'tailon-service-type' test.,
Ludovic Courtès <=
- [bug#27650] [PATCH 2/2] tests: Add 'tailon-service-type' test., Christopher Baines, 2017/07/27
- [bug#27650] [PATCH] gnu: services: admin: Add tailon., Christopher Baines, 2017/07/27
- [bug#27650] [PATCH] gnu: services: admin: Add tailon., Ludovic Courtès, 2017/07/28
- [bug#27650] [PATCH] gnu: services: admin: Add tailon., Christopher Baines, 2017/07/28
- bug#27650: [PATCH] gnu: services: admin: Add tailon., Christopher Baines, 2017/07/29
- [bug#27650] [PATCH] gnu: services: admin: Add tailon., Ludovic Courtès, 2017/07/29
[bug#27650] [PATCH 1/2] gnu: services: admin: Add tailon., Ludovic Courtès, 2017/07/26