diff options
author | Maxim Cournoyer <[email protected]> | 2024-11-01 20:29:23 +0900 |
---|---|---|
committer | Maxim Cournoyer <[email protected]> | 2025-02-13 00:07:21 +0900 |
commit | bcb5724e595108b098dfa2ad6af97e10afd0407c (patch) | |
tree | c3602e1e78ac9c9f42c0b2a93a8352a0c8da4680 /gnu/tests/web.scm | |
parent | a595a52b7b0849bc159fbf1d7cb0823444bd7449 (diff) |
tests: web: Add nginx+anonip test.
This test reproduces the problem reported in bug #59181 ("[berlin] web
services fail to start on reboot due to anonip").
* gnu/tests/web.scm (run-webserver-test) <extra-args>: New keyword argument.
(%nginx+anonip-os, nginx-anonip-tests, %test-nginx+anonip): New variables.
Change-Id: I7bbc8fb9f2ab33ce89bf1c0945d7ddbddf26a7ea
Diffstat (limited to 'gnu/tests/web.scm')
-rw-r--r-- | gnu/tests/web.scm | 43 |
1 files changed, 40 insertions, 3 deletions
diff --git a/gnu/tests/web.scm b/gnu/tests/web.scm index f04f6b244a..84201e11c2 100644 --- a/gnu/tests/web.scm +++ b/gnu/tests/web.scm @@ -50,6 +50,7 @@ #:use-module (ice-9 match) #:export (%test-httpd %test-nginx + %test-nginx+anonip %test-varnish %test-php-fpm %test-hpcguix-web @@ -91,9 +92,11 @@ (sleep delay) (loop (+ 1 attempt))))))))) -(define* (run-webserver-test name test-os #:key (log-file #f) (http-port 8080)) - "Run tests in %NGINX-OS, which has nginx running and listening on -HTTP-PORT." +(define* (run-webserver-test name test-os #:key (log-file #f) (http-port 8080) + extra-tests) + "Run tests in %NGINX-OS, which has nginx running and listening on HTTP-PORT. +EXTRA-TESTS should be a sexp of gexp containing extra code to run as part of +the tests." (define os (marionette-operating-system test-os @@ -154,6 +157,8 @@ HTTP-PORT." marionette))) '()) + #$extra-tests + (test-end)))) (gexp->derivation (string-append name "-test") test)) @@ -209,6 +214,38 @@ HTTP-PORT." (value (run-webserver-test name %nginx-os #:log-file "/var/log/nginx/access.log")))) +(define %nginx+anonip-os + (simple-operating-system + (service dhcp-client-service-type) + (service anonip-service-type + (anonip-configuration + (input "/var/run/anonip/access.log") + (output "/var/log/anonip/access.log") + (debug? #t))) + (service nginx-service-type + (nginx-configuration + (log-directory "/var/run/anonip/") + (server-blocks %nginx-servers) + (shepherd-requirement '(anonip-/var/log/anonip/access.log)))) + (simple-service 'make-http-root activation-service-type + %make-http-root))) + +(define nginx-anonip-tests + #~(test-assert "anonip service is running" + (marionette-eval + '(begin + (use-modules (gnu services herd)) + (wait-for-service 'anonip-/var/log/anonip/access.log)) + marionette))) + +(define %test-nginx+anonip + (system-test + (name "nginx+anonip") + (description "Run a NGINX server with logs anonymized by Anonip") + (value (run-webserver-test "nginx" %nginx+anonip-os + #:log-file "/var/log/anonip/access.log" + #:extra-tests nginx-anonip-tests)))) + ;;; ;;; Varnish |