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."
609 609
610(define (patchwork-initial-database-setup-service configuration) 610(define (patchwork-initial-database-setup-service configuration)
611 (define start-gexp 611 (define start-gexp
612 #~(lambda () 612 #~(primitive-exit
613 (let ((pid (primitive-fork)) 613 (if (and
614 (postgres (getpwnam "postgres"))) 614 (zero?
615 (if (eq? pid 0) 615 (system* #$(file-append postgresql "/bin/createuser")
616 (dynamic-wind 616 #$(patchwork-database-configuration-user
617 (const #t) 617 configuration)))
618 (lambda () 618 (zero?
619 (setgid (passwd:gid postgres)) 619 (system* #$(file-append postgresql "/bin/createdb")
620 (setuid (passwd:uid postgres)) 620 "-O"
621 (primitive-exit 621 #$(patchwork-database-configuration-user
622 (if (and 622 configuration)
623 (zero? 623 #$(patchwork-database-configuration-name
624 (system* #$(file-append postgresql "/bin/createuser") 624 configuration))))
625 #$(patchwork-database-configuration-user 625 0
626 configuration))) 626 1)))
627 (zero?
628 (system* #$(file-append postgresql "/bin/createdb")
629 "-O"
630 #$(patchwork-database-configuration-user
631 configuration)
632 #$(patchwork-database-configuration-name
633 configuration))))
634 0
635 1)))
636 (lambda ()
637 (primitive-exit 1)))
638 (zero? (cdr (waitpid pid)))))))
639 627
640 (shepherd-service 628 (shepherd-service
641 (requirement '(postgres)) 629 (requirement '(postgres))
642 (provision '(patchwork-postgresql-user-and-database)) 630 (provision '(patchwork-postgresql-user-and-database))
643 (start start-gexp) 631 (start #~(lambda _
632 (zero? (spawn-command
633 '(#$(program-file "patchwork-initial-database-setup"
634 start-gexp))
635 #:user "postgres"
636 #:group "postgres"))))
644 (stop #~(const #f)) 637 (stop #~(const #f))
645 (respawn? #f)
646 (documentation "Setup patchwork database."))) 638 (documentation "Setup patchwork database.")))
647 639
648(define (patchwork-os patchwork) 640(define (patchwork-os patchwork)
@@ -724,6 +716,18 @@ HTTP-PORT."
724 ((pid) pid))))) 716 ((pid) pid)))))
725 marionette)) 717 marionette))
726 718
719 (test-assert "patchwork-setup started"
720 (marionette-eval
721 '(begin
722 (use-modules (gnu services herd))
723 (match (start-service 'patchwork-setup)
724 (#f #f)
725 (('service response-parts ...)
726 (match (assq-ref response-parts 'running)
727 ((#t) #t)
728 ((pid) pid)))))
729 marionette))
730
727 (test-assert "httpd running" 731 (test-assert "httpd running"
728 (marionette-eval 732 (marionette-eval
729 '(begin 733 '(begin