@@ -1,6 +1,6 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2017 Peter Mikkelsen <petermikkelsen10@gmail.com>
-;;; Copyright © 2022 Bruno Victal <mirai@makinata.eu>
+;;; Copyright © 2022–2023 Bruno Victal <mirai@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))