summaryrefslogtreecommitdiff
path: root/gnu/tests
diff options
context:
space:
mode:
authorChristopher Baines <mail@cbaines.net>2025-11-10 10:19:48 +0000
committerChristopher Baines <mail@cbaines.net>2025-11-10 10:27:36 +0000
commitf7125fb55d06cc2ad6bcd86b8071ea079a9ca179 (patch)
tree2478c50d3eb1c81cca5af3e1f4bf326d01b8b2ad /gnu/tests
parent9bf06d93a47db1200eabc055e64e832d6a5fd603 (diff)
gnu: Fix patchwork service test.
* gnu/packages/patchutils.scm (patchwork):[arguments]: Write version.txt, tweak some indentation, patch the STATICFILES_DIRS entry. [propagated-inputs]: Add python-tzdata. * gnu/services/web.scm (patchwork-settings-module-compiler): Don't set STATIC_ROOT on debug, as this clashes with STATICFILES_DIRS. (patchwork-django-admin-gexp): Fix. (patchwork-shepherd-services): Workaround issue referencing random-token. * gnu/tests/web.scm (patchwork-initial-database-setup-service): Don't use primitive-fork, as this doesn't work with newer shepherds. (run-patchwork-test): Check the setup runs. Change-Id: I7dfeb816b4f6c9070358d433fb7ca8faa1fbfd2a
Diffstat (limited to 'gnu/tests')
-rw-r--r--gnu/tests/web.scm62
1 files changed, 33 insertions, 29 deletions
diff --git a/gnu/tests/web.scm b/gnu/tests/web.scm
index 419b5f0b5bf..47879aa08f7 100644
--- a/gnu/tests/web.scm
+++ b/gnu/tests/web.scm
@@ -609,40 +609,32 @@ HTTP-PORT, along with php-fpm."
(define (patchwork-initial-database-setup-service configuration)
(define start-gexp
- #~(lambda ()
- (let ((pid (primitive-fork))
- (postgres (getpwnam "postgres")))
- (if (eq? pid 0)
- (dynamic-wind
- (const #t)
- (lambda ()
- (setgid (passwd:gid postgres))
- (setuid (passwd:uid postgres))
- (primitive-exit
- (if (and
- (zero?
- (system* #$(file-append postgresql "/bin/createuser")
- #$(patchwork-database-configuration-user
- configuration)))
- (zero?
- (system* #$(file-append postgresql "/bin/createdb")
- "-O"
- #$(patchwork-database-configuration-user
- configuration)
- #$(patchwork-database-configuration-name
- configuration))))
- 0
- 1)))
- (lambda ()
- (primitive-exit 1)))
- (zero? (cdr (waitpid pid)))))))
+ #~(primitive-exit
+ (if (and
+ (zero?
+ (system* #$(file-append postgresql "/bin/createuser")
+ #$(patchwork-database-configuration-user
+ configuration)))
+ (zero?
+ (system* #$(file-append postgresql "/bin/createdb")
+ "-O"
+ #$(patchwork-database-configuration-user
+ configuration)
+ #$(patchwork-database-configuration-name
+ configuration))))
+ 0
+ 1)))
(shepherd-service
(requirement '(postgres))
(provision '(patchwork-postgresql-user-and-database))
- (start start-gexp)
+ (start #~(lambda _
+ (zero? (spawn-command
+ '(#$(program-file "patchwork-initial-database-setup"
+ start-gexp))
+ #:user "postgres"
+ #:group "postgres"))))
(stop #~(const #f))
- (respawn? #f)
(documentation "Setup patchwork database.")))
(define (patchwork-os patchwork)
@@ -724,6 +716,18 @@ HTTP-PORT."
((pid) pid)))))
marionette))
+ (test-assert "patchwork-setup started"
+ (marionette-eval
+ '(begin
+ (use-modules (gnu services herd))
+ (match (start-service 'patchwork-setup)
+ (#f #f)
+ (('service response-parts ...)
+ (match (assq-ref response-parts 'running)
+ ((#t) #t)
+ ((pid) pid)))))
+ marionette))
+
(test-assert "httpd running"
(marionette-eval
'(begin