summary refs log tree commit diff
path: root/gnu/tests/ssh.scm
diff options
context:
space:
mode:
Diffstat (limited to 'gnu/tests/ssh.scm')
-rw-r--r--gnu/tests/ssh.scm46
1 files changed, 29 insertions, 17 deletions
diff --git a/gnu/tests/ssh.scm b/gnu/tests/ssh.scm
index 791ff7b73f..3f550db5ea 100644
--- a/gnu/tests/ssh.scm
+++ b/gnu/tests/ssh.scm
@@ -1,5 +1,5 @@
 ;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2016, 2017, 2018, 2019, 2020, 2021 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2016-2022 Ludovic Courtès <ludo@gnu.org>
 ;;; Copyright © 2017, 2018 Clément Lassieur <clement@lassieur.org>
 ;;; Copyright © 2017 Marius Bakke <mbakke@fastmail.com>
 ;;;
@@ -120,23 +120,35 @@ root with an empty password."
                marionette))
 
             ;; Check sshd's PID file.
-            (test-equal "sshd PID"
-              (wait-for-file #$pid-file marionette)
-              (marionette-eval
-               '(begin
-                  (use-modules (gnu services herd)
-                               (srfi srfi-1))
-
-                  (live-service-running
-                   (find (lambda (live)
-                           (memq 'ssh-daemon
-                                 (live-service-provision live)))
-                         (current-services))))
-               marionette))
-
-            (test-assert "wait for port 22"
+            (test-assert "sshd PID"
+              (let ((pid (marionette-eval
+                          '(begin
+                             (use-modules (gnu services herd)
+                                          (srfi srfi-1))
+
+                             (live-service-running
+                              (find (lambda (live)
+                                      (memq 'ssh-daemon
+                                            (live-service-provision live)))
+                                    (current-services))))
+                          marionette)))
+                (if #$pid-file
+                    (= pid (wait-for-file #$pid-file marionette))
+                    pid)))
+
+            (test-assert "wait for port 22, IPv4"
               (wait-for-tcp-port 22 marionette))
 
+            (test-assert "wait for port 22, IPv6"
+              ;; Make sure it's also available as IPv6.
+              ;; See <https://issues.guix.gnu.org/55335>.
+              (wait-for-tcp-port 22 marionette
+                                 #:address
+                                 `(make-socket-address
+                                   AF_INET6
+                                   (inet-pton AF_INET6 "::1")
+                                   22)))
+
             ;; Connect to the guest over SSH.  Make sure we can run a shell
             ;; command there.
             (test-equal "shell command"
@@ -222,7 +234,7 @@ root with an empty password."
                                  (openssh-configuration
                                   (permit-root-login #t)
                                   (allow-empty-passwords? #t)))
-                        "/var/run/sshd.pid"
+                        #f                        ;inetd-style, no PID file
                         #:sftp? #t))))
 
 (define %test-dropbear