tests: nar-herder: Test the control port.

* gnu/services/guix.scm (nar-herder-shepherd-services): Add missing variables.
* gnu/tests/guix.scm (%nar-herder-os): Have the control server listen on all
interfaces.
(run-nar-herder-test): Test connecting to the control server.

Change-Id: I40949e8adaf0c6491ee56c59d611395a639d497b
This commit is contained in:
Christopher Baines 2025-10-25 10:52:29 +01:00
parent 3b19d7f548
commit edb1d29cf5
No known key found for this signature in database
GPG key ID: 5E28A33B0B84F577
2 changed files with 24 additions and 4 deletions

View file

@ -961,6 +961,7 @@ ca-certificates.crt file in the system profile."
mirror
database database-dump
host port
control-host control-port
storage storage-limit storage-minimum-free-space
storage-nar-removal-criteria
ttl new-ttl negative-ttl log-level

View file

@ -334,9 +334,10 @@ host all all ::1/128 trust"))))))
(service dhcpcd-service-type)
(service nar-herder-service-type
(nar-herder-configuration
(host "0.0.0.0")
;; Not a realistic value, but works for the test
(storage "/tmp")))))
(host "0.0.0.0")
(control-host "0.0.0.0")
;; Not a realistic value, but works for the test
(storage "/tmp")))))
(define (run-nar-herder-test)
(define os
@ -349,11 +350,17 @@ host all all ::1/128 trust"))))))
(nar-herder-configuration-port
(nar-herder-configuration)))
(define control-forwarded-port
(nar-herder-configuration-control-port
(nar-herder-configuration)))
(define vm
(virtual-machine
(operating-system os)
(memory-size 1024)
(port-forwardings `((,forwarded-port . ,forwarded-port)))))
(port-forwardings `((,forwarded-port . ,forwarded-port)
(,control-forwarded-port
. ,control-forwarded-port)))))
(define test
(with-imported-modules '((gnu build marionette))
@ -390,6 +397,16 @@ host all all ::1/128 trust"))))))
#:decode-body? #t)))
(response-code response)))
(test-equal "control http-get"
404
(let-values
(((response text)
(http-get #$(simple-format
#f "http://localhost:~A/"
control-forwarded-port)
#:decode-body? #t)))
(response-code response)))
(test-end))))
(gexp->derivation "nar-herder-test" test))
@ -477,3 +494,5 @@ host all all ::1/128 trust"))))))
(name "bffe")
(description "Connect to a running Build Farm Front-end.")
(value (run-bffe-test))))
%nar-herder-os