all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Maxim Cournoyer <maxim.cournoyer@gmail.com>
To: 74151@debbugs.gnu.org
Cc: Maxim Cournoyer <maxim.cournoyer@gmail.com>,
	Maxim Cournoyer <maxim.cournoyer@gmail.com>
Subject: [bug#74151] [PATCH v2 8/9] tests: web: Add nginx+anonip test.
Date: Fri,  1 Nov 2024 21:39:28 +0900	[thread overview]
Message-ID: <6099a6852bb8bdc693b273f3a7129767d8aabffc.1730464675.git.maxim.cournoyer@gmail.com> (raw)
In-Reply-To: <281a4773768a6c271ff464f473fdbc333a58c348.1730464675.git.maxim.cournoyer@gmail.com>

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
---
New commit in v2

 gnu/tests/web.scm | 43 ++++++++++++++++++++++++++++++++++++++++---
 1 file changed, 40 insertions(+), 3 deletions(-)

diff --git a/gnu/tests/web.scm b/gnu/tests/web.scm
index 6ef32138ed..33e0a697a8 100644
--- a/gnu/tests/web.scm
+++ b/gnu/tests/web.scm
@@ -50,6 +50,7 @@ (define-module (gnu tests web)
   #: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 @@ (define retry-on-error
                  (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 @@ (define* (run-webserver-test name test-os #:key (log-file #f) (http-port 8080))
                       marionette)))
                  '())
 
+          #$extra-tests
+
           (test-end))))
 
   (gexp->derivation (string-append name "-test") test))
@@ -209,6 +214,38 @@ (define %test-nginx
    (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))))
+
 \f
 ;;;
 ;;; Varnish
-- 
2.46.0





  parent reply	other threads:[~2024-11-01 12:43 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-01  6:20 [bug#74151] [PATCH 0/7] Add anonip system test Maxim Cournoyer
2024-11-01  7:11 ` [bug#74151] [PATCH 1/7] doc: Use @table @code for anonip-configuration doc Maxim Cournoyer
2024-11-01  7:11 ` [bug#74151] [PATCH 2/7] services: anonip: Add 'debug?' configuration field Maxim Cournoyer
2024-11-01  7:11 ` [bug#74151] [PATCH 3/7] system/vm: Fix virtual-machine bug Maxim Cournoyer
2024-11-01  7:11 ` [bug#74151] [PATCH 4/7] tests: web: Have the retry-on-error throw on exhausted attempts Maxim Cournoyer
2024-11-01  7:11 ` [bug#74151] [PATCH 5/7] services: herd: Export 'eval-there' in API Maxim Cournoyer
2024-11-01  7:11 ` [bug#74151] [PATCH 6/7] build: marionette: Make it possible to reboot VM during tests Maxim Cournoyer
2024-11-01  7:11 ` [bug#74151] [PATCH 7/7] tests: Add anonip system test Maxim Cournoyer
2024-11-01 12:39 ` [bug#74151] [PATCH v2 1/9] doc: Use @table @code for anonip-configuration doc Maxim Cournoyer
2024-11-01 12:39   ` [bug#74151] [PATCH v2 2/9] services: anonip: Add 'debug?' configuration field Maxim Cournoyer
2024-11-01 12:39   ` [bug#74151] [PATCH v2 3/9] system/vm: Fix virtual-machine bug Maxim Cournoyer
2024-11-01 12:39   ` [bug#74151] [PATCH v2 4/9] tests: web: Have the retry-on-error throw on exhausted attempts Maxim Cournoyer
2024-11-01 12:39   ` [bug#74151] [PATCH v2 5/9] services: herd: Export 'eval-there' in API Maxim Cournoyer
2024-11-01 12:39   ` [bug#74151] [PATCH v2 6/9] build: marionette: Make it possible to reboot VM during tests Maxim Cournoyer
2024-11-01 12:39   ` [bug#74151] [PATCH v2 7/9] tests: Add anonip system test Maxim Cournoyer
2024-11-01 12:39   ` Maxim Cournoyer [this message]
2024-11-01 12:39   ` [bug#74151] [PATCH v2 9/9] services: web: Fix race between nginx activation and anonip Maxim Cournoyer

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=6099a6852bb8bdc693b273f3a7129767d8aabffc.1730464675.git.maxim.cournoyer@gmail.com \
    --to=maxim.cournoyer@gmail.com \
    --cc=74151@debbugs.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 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.