summaryrefslogtreecommitdiff
path: root/gnu/tests
diff options
context:
space:
mode:
authorChristopher Baines <mail@cbaines.net>2023-08-26 10:08:56 +0100
committerChristopher Baines <mail@cbaines.net>2023-09-15 09:57:32 +0100
commit82abf6ddadc6139148660440a064e60ae68f238e (patch)
treef331335b0a62b11a5c57eb44ffce4e36fde9852e /gnu/tests
parentdca96f27ed5b870109c26836d32d991fcfbedaab (diff)
services: guix: Add bffe-service-type.
This is intended to replace the functionality of the Guix Build Coordinator queue builds script, and also provide a web interface for build farms. * gnu/services/guix.scm (<bffe-configuration>): New record type. (bffe-configuration, bffe-configuration?, bffe-configuration-package, bffe-configuration-user, bffe-configuration-group, bffe-configuration-arguments bffe-configuration-extra-environment-variables): New procedures. (bffe-service-type): New variable. * gnu/tests/guix.scm (%test-bffe): New variable. * doc/guix.texi (Guix Services): Document the new service.
Diffstat (limited to 'gnu/tests')
-rw-r--r--gnu/tests/guix.scm81
1 files changed, 80 insertions, 1 deletions
diff --git a/gnu/tests/guix.scm b/gnu/tests/guix.scm
index ad0980a10c..240ded4825 100644
--- a/gnu/tests/guix.scm
+++ b/gnu/tests/guix.scm
@@ -37,7 +37,8 @@
#:use-module (ice-9 match)
#:export (%test-guix-build-coordinator
%test-guix-data-service
- %test-nar-herder))
+ %test-nar-herder
+ %test-bffe))
;;;
;;; Guix Build Coordinator
@@ -325,3 +326,81 @@ host all all ::1/128 trust"))))))
(name "nar-herder")
(description "Connect to a running Nar Herder server.")
(value (run-nar-herder-test))))
+
+
+;;;
+;;; Build Farm Front-end
+;;;
+
+(define %bffe-os
+ (simple-operating-system
+ (service dhcp-client-service-type)
+ (service guix-build-coordinator-service-type)
+ (service bffe-service-type
+ (bffe-configuration
+ (arguments
+ #~(list
+ #:web-server-args
+ '(#:port 8767
+ #:controller-args
+ (#:title "Test title"))))))))
+
+(define (run-bffe-test)
+ (define os
+ (marionette-operating-system
+ %bffe-os
+ #:imported-modules '((gnu services herd)
+ (guix combinators))))
+
+ (define forwarded-port 8767)
+
+ (define vm
+ (virtual-machine
+ (operating-system os)
+ (memory-size 1024)
+ (port-forwardings `((,forwarded-port . 8767)))))
+
+ (define test
+ (with-imported-modules '((gnu build marionette))
+ #~(begin
+ (use-modules (srfi srfi-11) (srfi srfi-64)
+ (gnu build marionette)
+ (web uri)
+ (web client)
+ (web response))
+
+ (define marionette
+ (make-marionette (list #$vm)))
+
+ (test-runner-current (system-test-runner #$output))
+ (test-begin "bffe")
+
+ (test-assert "service running"
+ (marionette-eval
+ '(begin
+ (use-modules (gnu services herd))
+ (match (start-service 'bffe)
+ (#f #f)
+ (('service response-parts ...)
+ (match (assq-ref response-parts 'running)
+ ((pid) (number? pid))))))
+ marionette))
+
+ (test-equal "http-get"
+ 200
+ (let-values
+ (((response text)
+ (http-get #$(simple-format
+ #f "http://localhost:~A/" forwarded-port)
+ #:decode-body? #t)))
+ (response-code response)))
+
+ (test-end))))
+
+ (gexp->derivation "bffe-test" test))
+
+(define %test-bffe
+ (system-test
+ (name "bffe")
+ (description "Connect to a running Build Farm Front-end.")
+ (value (run-bffe-test))))