GNU bug report logs - #67842
[PATCH 0/4] Refactor mympd service.

Previous Next

Package: guix-patches;

Reported by: Bruno Victal <mirai <at> makinata.eu>

Date: Fri, 15 Dec 2023 21:02:02 UTC

Severity: normal

Tags: patch

Full log


View this message in rfc822 format

From: Bruno Victal <mirai <at> makinata.eu>
To: 67842 <at> debbugs.gnu.org
Cc: Bruno Victal <mirai <at> makinata.eu>
Subject: [bug#67842] [PATCH 2/4] tests: mympd: Simplify test.
Date: Fri, 15 Dec 2023 21:02:37 +0000
* gnu/tests/audio.scm: (run-mympd-test): Restyle.
Remove dhcp-client-service-type. Remove port-forwards and refactor http-head
test to happen within the VM instead of the host.
---
 gnu/tests/audio.scm | 35 +++++++++++++++++------------------
 1 file changed, 17 insertions(+), 18 deletions(-)

diff --git a/gnu/tests/audio.scm b/gnu/tests/audio.scm
index acb91293e8..a0ab54da2a 100644
--- a/gnu/tests/audio.scm
+++ b/gnu/tests/audio.scm
@@ -1,6 +1,6 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2017 Peter Mikkelsen <petermikkelsen10 <at> gmail.com>
-;;; Copyright © 2022 Bruno Victal <mirai <at> makinata.eu>
+;;; Copyright © 2022⁠–⁠2023 Bruno Victal <mirai <at> makinata.eu>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -81,23 +81,17 @@ (define %test-mpd
    (value (run-mpd-test))))
 
 (define (run-mympd-test)
-  (define os (marionette-operating-system
-              (simple-operating-system (service dhcp-client-service-type)
-                                       (service mympd-service-type))
-              #:imported-modules '((gnu services herd))))
+  (define os
+    (marionette-operating-system
+     (simple-operating-system (service mympd-service-type))
+     #:imported-modules '((gnu services herd))))
 
-  (define vm
-    (virtual-machine
-     (operating-system os)
-     (port-forwardings '((8080 . 80)))))
+  (define vm (virtual-machine os))
 
   (define test
     (with-imported-modules '((gnu build marionette))
       #~(begin
           (use-modules (srfi srfi-64)
-                       (srfi srfi-8)
-                       (web client)
-                       (web response)
                        (gnu build marionette))
 
           (define marionette
@@ -106,18 +100,23 @@ (define (run-mympd-test)
           (test-runner-current (system-test-runner #$output))
           (test-begin "mympd")
           (test-assert "service is running"
-            (marionette-eval '(begin
-                                (use-modules (gnu services herd))
-
-                                (start-service 'mympd))
-                             marionette))
+            (marionette-eval
+             '(begin
+                (use-modules (gnu services herd))
+                (start-service 'mympd))
+             marionette))
 
           (test-assert "HTTP port ready"
             (wait-for-tcp-port 80 marionette))
 
           (test-equal "http-head"
             200
-            (receive (x _) (http-head "http://localhost:8080") (response-code x)))
+            (marionette-eval
+             '(begin
+                (use-modules (web client)
+                             (web response))
+                (response-code (http-head "http://localhost")))
+             marionette))
 
           (test-end))))
   (gexp->derivation "mympd-test" test))
-- 
2.41.0





This bug report was last modified 1 year and 186 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.