diff options
| author | Ludovic Courtès <ludo@gnu.org> | 2024-12-09 22:41:29 +0100 |
|---|---|---|
| committer | Ludovic Courtès <ludo@gnu.org> | 2024-12-09 23:15:44 +0100 |
| commit | e7cd328714be93ed6a931c9110b52adc7b439752 (patch) | |
| tree | e8a58013422bc21624816e9063c0a7333810e97a /gnu/tests | |
| parent | 51ee3a727877500ad426e2c37a990df15d1283f5 (diff) | |
tests: Adjust for new return value of ‘start-service’.
In Shepherd 1.0, the “running value” of processes is no longer a plain
integer; instead, it is a (process …) sexp. This commit adjusts tests
to this change in a way that works both for 1.0 and for previous
versions.
* gnu/tests/databases.scm (run-memcached-test)
(run-mysql-test): Don’t expect PID to be a number.
* gnu/tests/docker.scm (run-docker-test)
(run-docker-system-test, run-oci-container-test): Likewise.
* gnu/tests/guix.scm (run-guix-build-coordinator-test)
(run-guix-data-service-test, run-nar-herder-test)
(run-bffe-test): Likewise.
* gnu/tests/ldap.scm (run-ldap-test): Likewise.
* gnu/tests/monitoring.scm (run-prometheus-node-exporter-server-test):
Likewise.
* gnu/tests/virtualization.scm (run-libvirt-test)
(run-qemu-guest-agent-test, run-childhurd-test): Likewise.
* gnu/tests/web.scm (run-webserver-test, run-php-fpm-test)
(run-hpcguix-web-server-test, run-patchwork-test)
(run-agate-test): Likewise
* gnu/tests/ssh.scm (run-ssh-test): Accept a number, an ‘inetd-service’
sexp, or a ‘process’ sexp.
Change-Id: I8c7a37a981f0788780fbc33752a38e7f9a026437
Diffstat (limited to 'gnu/tests')
| -rw-r--r-- | gnu/tests/databases.scm | 4 | ||||
| -rw-r--r-- | gnu/tests/docker.scm | 14 | ||||
| -rw-r--r-- | gnu/tests/guix.scm | 10 | ||||
| -rw-r--r-- | gnu/tests/ldap.scm | 2 | ||||
| -rw-r--r-- | gnu/tests/monitoring.scm | 2 | ||||
| -rw-r--r-- | gnu/tests/ssh.scm | 23 | ||||
| -rw-r--r-- | gnu/tests/virtualization.scm | 6 | ||||
| -rw-r--r-- | gnu/tests/web.scm | 10 |
8 files changed, 40 insertions, 31 deletions
diff --git a/gnu/tests/databases.scm b/gnu/tests/databases.scm index 7c8b87942f9..fd5041344b6 100644 --- a/gnu/tests/databases.scm +++ b/gnu/tests/databases.scm | |||
| @@ -79,7 +79,7 @@ | |||
| 79 | (#f #f) | 79 | (#f #f) |
| 80 | (('service response-parts ...) | 80 | (('service response-parts ...) |
| 81 | (match (assq-ref response-parts 'running) | 81 | (match (assq-ref response-parts 'running) |
| 82 | ((pid) (number? pid)))))) | 82 | ((pid) pid))))) |
| 83 | marionette)) | 83 | marionette)) |
| 84 | 84 | ||
| 85 | (let* ((ai (car (getaddrinfo "localhost" | 85 | (let* ((ai (car (getaddrinfo "localhost" |
| @@ -433,7 +433,7 @@ data double PRECISION NULL | |||
| 433 | (#f #f) | 433 | (#f #f) |
| 434 | (('service response-parts ...) | 434 | (('service response-parts ...) |
| 435 | (match (assq-ref response-parts 'running) | 435 | (match (assq-ref response-parts 'running) |
| 436 | ((pid) (number? pid)))))) | 436 | ((pid) pid))))) |
| 437 | marionette)) | 437 | marionette)) |
| 438 | 438 | ||
| 439 | (test-assert "mysql_upgrade completed" | 439 | (test-assert "mysql_upgrade completed" |
diff --git a/gnu/tests/docker.scm b/gnu/tests/docker.scm index 46c886580c3..90c8d0f8508 100644 --- a/gnu/tests/docker.scm +++ b/gnu/tests/docker.scm | |||
| @@ -97,7 +97,7 @@ inside %DOCKER-OS." | |||
| 97 | (#f #f) | 97 | (#f #f) |
| 98 | (('service response-parts ...) | 98 | (('service response-parts ...) |
| 99 | (match (assq-ref response-parts 'running) | 99 | (match (assq-ref response-parts 'running) |
| 100 | ((pid) (number? pid)))))) | 100 | ((pid) pid))))) |
| 101 | marionette)) | 101 | marionette)) |
| 102 | 102 | ||
| 103 | (test-assert "containerd PID file present" | 103 | (test-assert "containerd PID file present" |
| @@ -111,7 +111,7 @@ inside %DOCKER-OS." | |||
| 111 | (#f #f) | 111 | (#f #f) |
| 112 | (('service response-parts ...) | 112 | (('service response-parts ...) |
| 113 | (match (assq-ref response-parts 'running) | 113 | (match (assq-ref response-parts 'running) |
| 114 | ((pid) (number? pid)))))) | 114 | ((pid) pid))))) |
| 115 | marionette)) | 115 | marionette)) |
| 116 | 116 | ||
| 117 | (test-eq "fetch version" | 117 | (test-eq "fetch version" |
| @@ -257,7 +257,7 @@ inside %DOCKER-OS." | |||
| 257 | (#f #f) | 257 | (#f #f) |
| 258 | (('service response-parts ...) | 258 | (('service response-parts ...) |
| 259 | (match (assq-ref response-parts 'running) | 259 | (match (assq-ref response-parts 'running) |
| 260 | ((pid) (number? pid)))))) | 260 | ((pid) pid))))) |
| 261 | marionette)) | 261 | marionette)) |
| 262 | 262 | ||
| 263 | (test-assert "containerd PID file present" | 263 | (test-assert "containerd PID file present" |
| @@ -271,7 +271,7 @@ inside %DOCKER-OS." | |||
| 271 | (#f #f) | 271 | (#f #f) |
| 272 | (('service response-parts ...) | 272 | (('service response-parts ...) |
| 273 | (match (assq-ref response-parts 'running) | 273 | (match (assq-ref response-parts 'running) |
| 274 | ((pid) (number? pid)))))) | 274 | ((pid) pid))))) |
| 275 | marionette)) | 275 | marionette)) |
| 276 | 276 | ||
| 277 | (test-assert "load system image and run it" | 277 | (test-assert "load system image and run it" |
| @@ -422,7 +422,7 @@ docker-image} inside Docker.") | |||
| 422 | (#f #f) | 422 | (#f #f) |
| 423 | (('service response-parts ...) | 423 | (('service response-parts ...) |
| 424 | (match (assq-ref response-parts 'running) | 424 | (match (assq-ref response-parts 'running) |
| 425 | ((pid) (number? pid)))))) | 425 | ((pid) pid))))) |
| 426 | marionette)) | 426 | marionette)) |
| 427 | 427 | ||
| 428 | (test-assert "containerd PID file present" | 428 | (test-assert "containerd PID file present" |
| @@ -436,7 +436,7 @@ docker-image} inside Docker.") | |||
| 436 | (#f #f) | 436 | (#f #f) |
| 437 | (('service response-parts ...) | 437 | (('service response-parts ...) |
| 438 | (match (assq-ref response-parts 'running) | 438 | (match (assq-ref response-parts 'running) |
| 439 | ((pid) (number? pid)))))) | 439 | ((pid) pid))))) |
| 440 | marionette)) | 440 | marionette)) |
| 441 | 441 | ||
| 442 | (sleep 10) ; let service start | 442 | (sleep 10) ; let service start |
| @@ -449,7 +449,7 @@ docker-image} inside Docker.") | |||
| 449 | (#f #f) | 449 | (#f #f) |
| 450 | (('service response-parts ...) | 450 | (('service response-parts ...) |
| 451 | (match (assq-ref response-parts 'running) | 451 | (match (assq-ref response-parts 'running) |
| 452 | ((pid) (number? pid)))))) | 452 | ((pid) pid))))) |
| 453 | marionette)) | 453 | marionette)) |
| 454 | 454 | ||
| 455 | (test-equal "passing host environment variables and volumes" | 455 | (test-equal "passing host environment variables and volumes" |
diff --git a/gnu/tests/guix.scm b/gnu/tests/guix.scm index 98afc4a3506..fbc779828c4 100644 --- a/gnu/tests/guix.scm +++ b/gnu/tests/guix.scm | |||
| @@ -90,7 +90,7 @@ | |||
| 90 | (#f #f) | 90 | (#f #f) |
| 91 | (('service response-parts ...) | 91 | (('service response-parts ...) |
| 92 | (match (assq-ref response-parts 'running) | 92 | (match (assq-ref response-parts 'running) |
| 93 | ((pid) (number? pid)))))) | 93 | ((pid) pid))))) |
| 94 | marionette)) | 94 | marionette)) |
| 95 | 95 | ||
| 96 | (test-equal "http-get" | 96 | (test-equal "http-get" |
| @@ -212,7 +212,7 @@ host all all ::1/128 trust")))))) | |||
| 212 | (#f #f) | 212 | (#f #f) |
| 213 | (('service response-parts ...) | 213 | (('service response-parts ...) |
| 214 | (match (assq-ref response-parts 'running) | 214 | (match (assq-ref response-parts 'running) |
| 215 | ((pid) (number? pid)))))) | 215 | ((pid) pid))))) |
| 216 | marionette)) | 216 | marionette)) |
| 217 | 217 | ||
| 218 | (test-assert "process jobs service running" | 218 | (test-assert "process jobs service running" |
| @@ -223,7 +223,7 @@ host all all ::1/128 trust")))))) | |||
| 223 | (#f #f) | 223 | (#f #f) |
| 224 | (('service response-parts ...) | 224 | (('service response-parts ...) |
| 225 | (match (assq-ref response-parts 'running) | 225 | (match (assq-ref response-parts 'running) |
| 226 | ((pid) (number? pid)))))) | 226 | ((pid) pid))))) |
| 227 | marionette)) | 227 | marionette)) |
| 228 | 228 | ||
| 229 | ;; The service starts immediately but replies with status 500 until | 229 | ;; The service starts immediately but replies with status 500 until |
| @@ -378,7 +378,7 @@ host all all ::1/128 trust")))))) | |||
| 378 | (#f #f) | 378 | (#f #f) |
| 379 | (('service response-parts ...) | 379 | (('service response-parts ...) |
| 380 | (match (assq-ref response-parts 'running) | 380 | (match (assq-ref response-parts 'running) |
| 381 | ((pid) (number? pid)))))) | 381 | ((pid) pid))))) |
| 382 | marionette)) | 382 | marionette)) |
| 383 | 383 | ||
| 384 | (test-equal "http-get" | 384 | (test-equal "http-get" |
| @@ -456,7 +456,7 @@ host all all ::1/128 trust")))))) | |||
| 456 | (#f #f) | 456 | (#f #f) |
| 457 | (('service response-parts ...) | 457 | (('service response-parts ...) |
| 458 | (match (assq-ref response-parts 'running) | 458 | (match (assq-ref response-parts 'running) |
| 459 | ((pid) (number? pid)))))) | 459 | ((pid) pid))))) |
| 460 | marionette)) | 460 | marionette)) |
| 461 | 461 | ||
| 462 | (test-equal "http-get" | 462 | (test-equal "http-get" |
diff --git a/gnu/tests/ldap.scm b/gnu/tests/ldap.scm index d5ab6899cf8..2cf7491f3e5 100644 --- a/gnu/tests/ldap.scm +++ b/gnu/tests/ldap.scm | |||
| @@ -124,7 +124,7 @@ suffix = dc=example,dc=com"))) | |||
| 124 | (#f #f) | 124 | (#f #f) |
| 125 | (('service response-parts ...) | 125 | (('service response-parts ...) |
| 126 | (match (assq-ref response-parts 'running) | 126 | (match (assq-ref response-parts 'running) |
| 127 | ((pid) (number? pid)))))) | 127 | ((pid) pid))))) |
| 128 | marionette)) | 128 | marionette)) |
| 129 | 129 | ||
| 130 | (test-assert "nslcd produces a log file" | 130 | (test-assert "nslcd produces a log file" |
diff --git a/gnu/tests/monitoring.scm b/gnu/tests/monitoring.scm index a0c8c929b11..a9545410ecd 100644 --- a/gnu/tests/monitoring.scm +++ b/gnu/tests/monitoring.scm | |||
| @@ -74,7 +74,7 @@ | |||
| 74 | (#f #f) | 74 | (#f #f) |
| 75 | (('service response-parts ...) | 75 | (('service response-parts ...) |
| 76 | (match (assq-ref response-parts 'running) | 76 | (match (assq-ref response-parts 'running) |
| 77 | ((pid) (number? pid)))))) | 77 | ((pid) pid))))) |
| 78 | marionette)) | 78 | marionette)) |
| 79 | 79 | ||
| 80 | (test-equal "http-get" | 80 | (test-equal "http-get" |
diff --git a/gnu/tests/ssh.scm b/gnu/tests/ssh.scm index 3f550db5eac..4882c7a88b1 100644 --- a/gnu/tests/ssh.scm +++ b/gnu/tests/ssh.scm | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | ;;; GNU Guix --- Functional package management for GNU | 1 | ;;; GNU Guix --- Functional package management for GNU |
| 2 | ;;; Copyright © 2016-2022 Ludovic Courtès <ludo@gnu.org> | 2 | ;;; Copyright © 2016-2022, 2024 Ludovic Courtès <ludo@gnu.org> |
| 3 | ;;; Copyright © 2017, 2018 Clément Lassieur <clement@lassieur.org> | 3 | ;;; Copyright © 2017, 2018 Clément Lassieur <clement@lassieur.org> |
| 4 | ;;; Copyright © 2017 Marius Bakke <mbakke@fastmail.com> | 4 | ;;; Copyright © 2017 Marius Bakke <mbakke@fastmail.com> |
| 5 | ;;; | 5 | ;;; |
| @@ -124,13 +124,22 @@ root with an empty password." | |||
| 124 | (let ((pid (marionette-eval | 124 | (let ((pid (marionette-eval |
| 125 | '(begin | 125 | '(begin |
| 126 | (use-modules (gnu services herd) | 126 | (use-modules (gnu services herd) |
| 127 | (srfi srfi-1)) | 127 | (srfi srfi-1) |
| 128 | (ice-9 match)) | ||
| 128 | 129 | ||
| 129 | (live-service-running | 130 | (match (live-service-running |
| 130 | (find (lambda (live) | 131 | (find (lambda (live) |
| 131 | (memq 'ssh-daemon | 132 | (memq 'ssh-daemon |
| 132 | (live-service-provision live))) | 133 | (live-service-provision live))) |
| 133 | (current-services)))) | 134 | (current-services))) |
| 135 | ((? number? pid) | ||
| 136 | ;; shepherd < 1.0.0 | ||
| 137 | pid) | ||
| 138 | (('inetd-service _ ...) | ||
| 139 | #t) | ||
| 140 | (('process ('version 0 _ ...) | ||
| 141 | ('id pid) _ ...) | ||
| 142 | pid))) | ||
| 134 | marionette))) | 143 | marionette))) |
| 135 | (if #$pid-file | 144 | (if #$pid-file |
| 136 | (= pid (wait-for-file #$pid-file marionette)) | 145 | (= pid (wait-for-file #$pid-file marionette)) |
diff --git a/gnu/tests/virtualization.scm b/gnu/tests/virtualization.scm index ed8d6b1c85b..a3c9c4014b3 100644 --- a/gnu/tests/virtualization.scm +++ b/gnu/tests/virtualization.scm | |||
| @@ -91,7 +91,7 @@ | |||
| 91 | (#f #f) | 91 | (#f #f) |
| 92 | (('service response-parts ...) | 92 | (('service response-parts ...) |
| 93 | (match (assq-ref response-parts 'running) | 93 | (match (assq-ref response-parts 'running) |
| 94 | ((pid) (number? pid)))))) | 94 | ((pid) pid))))) |
| 95 | marionette)) | 95 | marionette)) |
| 96 | 96 | ||
| 97 | ;; Give the libvirtd service time to start up. | 97 | ;; Give the libvirtd service time to start up. |
| @@ -206,7 +206,7 @@ | |||
| 206 | (#f #f) | 206 | (#f #f) |
| 207 | (('service response-parts ...) | 207 | (('service response-parts ...) |
| 208 | (match (assq-ref response-parts 'running) | 208 | (match (assq-ref response-parts 'running) |
| 209 | ((pid) (number? pid)))))) | 209 | ((pid) pid))))) |
| 210 | marionette)) | 210 | marionette)) |
| 211 | 211 | ||
| 212 | (test-equal "ping guest" | 212 | (test-equal "ping guest" |
| @@ -322,7 +322,7 @@ output." | |||
| 322 | (#f #f) | 322 | (#f #f) |
| 323 | (('service response-parts ...) | 323 | (('service response-parts ...) |
| 324 | (match (assq-ref response-parts 'running) | 324 | (match (assq-ref response-parts 'running) |
| 325 | ((pid) (number? pid)))))) | 325 | ((pid) pid))))) |
| 326 | marionette)) | 326 | marionette)) |
| 327 | 327 | ||
| 328 | (test-equal "childhurd SSH server replies" | 328 | (test-equal "childhurd SSH server replies" |
diff --git a/gnu/tests/web.scm b/gnu/tests/web.scm index a071e05e1d8..df937f38d4e 100644 --- a/gnu/tests/web.scm +++ b/gnu/tests/web.scm | |||
| @@ -128,7 +128,7 @@ HTTP-PORT." | |||
| 128 | (('service response-parts ...) | 128 | (('service response-parts ...) |
| 129 | (match (assq-ref response-parts 'running) | 129 | (match (assq-ref response-parts 'running) |
| 130 | ((#t) #t) | 130 | ((#t) #t) |
| 131 | ((pid) (number? pid)))))) | 131 | ((pid) pid))))) |
| 132 | marionette)) | 132 | marionette)) |
| 133 | 133 | ||
| 134 | (test-assert "HTTP port ready" | 134 | (test-assert "HTTP port ready" |
| @@ -320,7 +320,7 @@ HTTP-PORT, along with php-fpm." | |||
| 320 | (#f #f) | 320 | (#f #f) |
| 321 | (('service response-parts ...) | 321 | (('service response-parts ...) |
| 322 | (match (assq-ref response-parts 'running) | 322 | (match (assq-ref response-parts 'running) |
| 323 | ((pid) (number? pid)))))) | 323 | ((pid) pid))))) |
| 324 | marionette)) | 324 | marionette)) |
| 325 | 325 | ||
| 326 | (test-assert "nginx running" | 326 | (test-assert "nginx running" |
| @@ -401,7 +401,7 @@ HTTP-PORT, along with php-fpm." | |||
| 401 | (#f #f) | 401 | (#f #f) |
| 402 | (('service response-parts ...) | 402 | (('service response-parts ...) |
| 403 | (match (assq-ref response-parts 'running) | 403 | (match (assq-ref response-parts 'running) |
| 404 | ((pid) (number? pid)))))) | 404 | ((pid) pid))))) |
| 405 | marionette)) | 405 | marionette)) |
| 406 | 406 | ||
| 407 | (test-equal "http-get" | 407 | (test-equal "http-get" |
| @@ -628,7 +628,7 @@ HTTP-PORT." | |||
| 628 | (('service response-parts ...) | 628 | (('service response-parts ...) |
| 629 | (match (assq-ref response-parts 'running) | 629 | (match (assq-ref response-parts 'running) |
| 630 | ((#t) #t) | 630 | ((#t) #t) |
| 631 | ((pid) (number? pid)))))) | 631 | ((pid) pid))))) |
| 632 | marionette)) | 632 | marionette)) |
| 633 | 633 | ||
| 634 | (test-assert "httpd running" | 634 | (test-assert "httpd running" |
| @@ -728,7 +728,7 @@ HTTP-PORT." | |||
| 728 | (('service response-parts ...) | 728 | (('service response-parts ...) |
| 729 | (match (assq-ref response-parts 'running) | 729 | (match (assq-ref response-parts 'running) |
| 730 | ((#t) #t) | 730 | ((#t) #t) |
| 731 | ((pid) (number? pid)))))) | 731 | ((pid) pid))))) |
| 732 | marionette)) | 732 | marionette)) |
| 733 | 733 | ||
| 734 | (test-assert "Agate TCP port ready, IPv4" | 734 | (test-assert "Agate TCP port ready, IPv4" |
