summaryrefslogtreecommitdiff
path: root/gnu/tests
diff options
context:
space:
mode:
authorChristopher Baines <mail@cbaines.net>2025-10-25 10:52:29 +0100
committerChristopher Baines <mail@cbaines.net>2025-10-25 10:54:05 +0100
commitedb1d29cf5b344f2edf268b482861310580d12be (patch)
tree5e81ea6bea4d2b0c12d9660c9c94d4d1696346d4 /gnu/tests
parent3b19d7f548e6ba53a45167a28ef19fd43e398396 (diff)
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
Diffstat (limited to 'gnu/tests')
-rw-r--r--gnu/tests/guix.scm27
1 files changed, 23 insertions, 4 deletions
diff --git a/gnu/tests/guix.scm b/gnu/tests/guix.scm
index 14982cf1b5c..8b692f28760 100644
--- a/gnu/tests/guix.scm
+++ b/gnu/tests/guix.scm
@@ -334,9 +334,10 @@ host all all ::1/128 trust"))))))
334 (service dhcpcd-service-type) 334 (service dhcpcd-service-type)
335 (service nar-herder-service-type 335 (service nar-herder-service-type
336 (nar-herder-configuration 336 (nar-herder-configuration
337 (host "0.0.0.0") 337 (host "0.0.0.0")
338 ;; Not a realistic value, but works for the test 338 (control-host "0.0.0.0")
339 (storage "/tmp"))))) 339 ;; Not a realistic value, but works for the test
340 (storage "/tmp")))))
340 341
341(define (run-nar-herder-test) 342(define (run-nar-herder-test)
342 (define os 343 (define os
@@ -349,11 +350,17 @@ host all all ::1/128 trust"))))))
349 (nar-herder-configuration-port 350 (nar-herder-configuration-port
350 (nar-herder-configuration))) 351 (nar-herder-configuration)))
351 352
353 (define control-forwarded-port
354 (nar-herder-configuration-control-port
355 (nar-herder-configuration)))
356
352 (define vm 357 (define vm
353 (virtual-machine 358 (virtual-machine
354 (operating-system os) 359 (operating-system os)
355 (memory-size 1024) 360 (memory-size 1024)
356 (port-forwardings `((,forwarded-port . ,forwarded-port))))) 361 (port-forwardings `((,forwarded-port . ,forwarded-port)
362 (,control-forwarded-port
363 . ,control-forwarded-port)))))
357 364
358 (define test 365 (define test
359 (with-imported-modules '((gnu build marionette)) 366 (with-imported-modules '((gnu build marionette))
@@ -390,6 +397,16 @@ host all all ::1/128 trust"))))))
390 #:decode-body? #t))) 397 #:decode-body? #t)))
391 (response-code response))) 398 (response-code response)))
392 399
400 (test-equal "control http-get"
401 404
402 (let-values
403 (((response text)
404 (http-get #$(simple-format
405 #f "http://localhost:~A/"
406 control-forwarded-port)
407 #:decode-body? #t)))
408 (response-code response)))
409
393 (test-end)))) 410 (test-end))))
394 411
395 (gexp->derivation "nar-herder-test" test)) 412 (gexp->derivation "nar-herder-test" test))
@@ -477,3 +494,5 @@ host all all ::1/128 trust"))))))
477 (name "bffe") 494 (name "bffe")
478 (description "Connect to a running Build Farm Front-end.") 495 (description "Connect to a running Build Farm Front-end.")
479 (value (run-bffe-test)))) 496 (value (run-bffe-test))))
497
498%nar-herder-os