summaryrefslogtreecommitdiff
path: root/gnu/tests
diff options
context:
space:
mode:
authorwrobell <wrobell@riseup.net>2026-06-14 17:57:57 +0100
committerSharlatan Hellseher <sharlatanus@gmail.com>2026-06-28 23:38:21 +0100
commitbfb35abf16bb4aa52b143dd1eb31ddef16898b37 (patch)
tree7cf18943cc25ccde62a98cd0c81d1e0e11d62e4a /gnu/tests
parent2983d36030ba74037667b28012c76d4bf35e459f (diff)
services: Update rabbitmq service
Update RabbitMQ default configuration to use localhost interface by default and avoid listening on public interfaces. Change the default configuration file to set inter-node communication listener to localhost network interface (see also https://www.rabbitmq.com/docs/networking#distribution). This requires setting RabbitMQ node name to `rabbit@localhost`, so introduce `node-name` RabbitMQ configuration field with such default value. Path to the RabbitMQ environment configuration file was hardcoded. Remove the hardcoding and allow to create such file with env-config-file RabbitMQ configuration field. Add new RabbitMQ service tests to check RabbitMQ broker startup and status after the service is started. * gnu/services/high-availability.scm (<rabbitmq-configuration>) [<node-name>, <env-config-file>]: New fields. (rabbitmq-shepherd-service): Use them. (%default-rabbitmq-config-file): Update. * gnu/tests/high-availability.scm (run-rabbitmq-test): Add new tests. * doc/gnu.texi (High Availability Services): Document new fields and provide information about local interfaces. Merges: guix/guix!9360 Signed-off-by: Sharlatan Hellseher <sharlatanus@gmail.com>
Diffstat (limited to 'gnu/tests')
-rw-r--r--gnu/tests/high-availability.scm31
1 files changed, 29 insertions, 2 deletions
diff --git a/gnu/tests/high-availability.scm b/gnu/tests/high-availability.scm
index 591e5f5bc23..6eb13d1a068 100644
--- a/gnu/tests/high-availability.scm
+++ b/gnu/tests/high-availability.scm
@@ -1,6 +1,6 @@
1;;; GNU Guix --- Functional package management for GNU 1;;; GNU Guix --- Functional package management for GNU
2;;; Copyright © 2017 Christopher Baines <mail@cbaines.net> 2;;; Copyright © 2017 Christopher Baines <mail@cbaines.net>
3;;; Copyright © 2025 Artur Wroblewski <wrobell@riseup.net> 3;;; Copyright © 2025-2026 Artur Wroblewski <wrobell@riseup.net>
4;;; 4;;;
5;;; This file is part of GNU Guix. 5;;; This file is part of GNU Guix.
6;;; 6;;;
@@ -19,6 +19,7 @@
19 19
20(define-module (gnu tests high-availability) 20(define-module (gnu tests high-availability)
21 #:use-module (gnu tests) 21 #:use-module (gnu tests)
22 #:use-module (gnu packages high-availability)
22 #:use-module (gnu system) 23 #:use-module (gnu system)
23 #:use-module (gnu system file-systems) 24 #:use-module (gnu system file-systems)
24 #:use-module (gnu system shadow) 25 #:use-module (gnu system shadow)
@@ -34,12 +35,15 @@
34 (plain-file "rabbitmq.conf" " 35 (plain-file "rabbitmq.conf" "
35listeners.tcp.1 = 127.0.0.1:15672 36listeners.tcp.1 = 127.0.0.1:15672
36listeners.tcp.2 = ::1:15672 37listeners.tcp.2 = ::1:15672
38
39distribution.listener.interface = 127.0.0.1
37")) 40"))
38 41
39(define %rabbitmq-os 42(define %rabbitmq-os
40 (simple-operating-system 43 (simple-operating-system
41 (service rabbitmq-service-type 44 (service rabbitmq-service-type
42 (rabbitmq-configuration (config-file %rabbitmq-config-file))))) 45 (rabbitmq-configuration (node-name "rabbit@komputilo")
46 (config-file %rabbitmq-config-file)))))
43 47
44(define* (run-rabbitmq-test #:key (rabbitmq-port 15672)) 48(define* (run-rabbitmq-test #:key (rabbitmq-port 15672))
45 "Run tests in %RABBITMQ-OS, forwarding PORT." 49 "Run tests in %RABBITMQ-OS, forwarding PORT."
@@ -94,6 +98,29 @@ listeners.tcp.2 = ::1:15672
94 '(file-exists? "/var/log/rabbitmq/rabbit@komputilo.log") 98 '(file-exists? "/var/log/rabbitmq/rabbit@komputilo.log")
95 marionette)) 99 marionette))
96 100
101 (test-assert "RabbitMQ await startup command is successful"
102 (marionette-eval
103 '(begin
104 (use-modules (guix build utils))
105
106 (current-output-port (open-file "/dev/console" "w0"))
107 (invoke #$(file-append rabbitmq "/sbin/rabbitmqctl")
108 "await_startup"
109 "-n"
110 "rabbit@komputilo"))
111 marionette))
112
113 (test-assert "RabbitMQ status command is successful"
114 (marionette-eval
115 '(begin
116 (use-modules (guix build utils))
117
118 (current-output-port (open-file "/dev/console" "w0"))
119 (invoke #$(file-append rabbitmq "/sbin/rabbitmqctl")
120 "status"
121 "-n"
122 "rabbit@komputilo"))
123 marionette))
97 (test-end)))) 124 (test-end))))
98 125
99 (gexp->derivation "rabbitmq-test" test)) 126 (gexp->derivation "rabbitmq-test" test))