From: Jakub Czajka Date: Wed, 15 Jul 2026 22:51:20 +0000 (+0000) Subject: [tests] Add SSH and networking test cases. X-Git-Url: https://git.ekhem.eu.org/?a=commitdiff_plain;h=9d17bb05d174a460cfd73b9186aa66905abfff50;p=guix.git [tests] Add SSH and networking test cases. Test SSH daemon (service, port 72, authorized_keys, key auth shell command) and networking (service, eth0). Co-Authored-By: Claude --- diff --git a/tests/networking.scm b/tests/networking.scm new file mode 100644 index 0000000..d08ad5f --- /dev/null +++ b/tests/networking.scm @@ -0,0 +1,22 @@ +;;; Copyright (c) 2026 Jakub Czajka +;;; License: GPL-3.0 or later. +;;; +;;; Static networking test cases. + +(define-module (tests networking) + #:use-module (guix gexp) + #:export (networking-test-cases)) + +(define (networking-test-cases marionette) + "Return a gexp with static networking test assertions." + #~(begin + (test-assert "net: service running" + (marionette-eval '(begin + (use-modules (gnu services herd)) + (start-service 'networking)) + #$marionette)) + + (test-assert "net: eth0 is up" + (marionette-eval '(file-exists? + "/sys/class/net/eth0/operstate") + #$marionette)))) diff --git a/tests/sshd.scm b/tests/sshd.scm new file mode 100644 index 0000000..9ac5023 --- /dev/null +++ b/tests/sshd.scm @@ -0,0 +1,31 @@ +;;; Copyright (c) 2026 Jakub Czajka +;;; License: GPL-3.0 or later. +;;; +;;; SSH daemon test cases. + +(define-module (tests sshd) + #:use-module (guix gexp) + #:export (sshd-test-cases)) + +(define (sshd-test-cases marionette connect-gexp) + "Return a gexp with SSH daemon test assertions." + #~(begin + (test-assert "sshd: service running" + (marionette-eval '(begin + (use-modules (gnu services herd)) + (start-service 'ssh-daemon)) + #$marionette)) + + (test-assert "sshd: port 72 TCP" + (wait-for-tcp-port 72 + #$marionette)) + + ;; Diagnostic: verify the authorized keys file is in place. + (test-assert "sshd: authorized_keys exists for dak" + (marionette-eval '(file-exists? + "/etc/ssh/authorized_keys.d/dak") + #$marionette)) + + (test-equal "sshd: shell command via key auth" + 'hello + (#$connect-gexp)))) diff --git a/tests/vps-base.scm b/tests/vps-base.scm index ca78a83..33fa71a 100644 --- a/tests/vps-base.scm +++ b/tests/vps-base.scm @@ -24,6 +24,8 @@ #:use-module (tests claude-code) #:use-module (tests dotfiles) #:use-module (tests paseo) + #:use-module (tests sshd) + #:use-module (tests networking) #:use-module (guix gexp) #:export (%test-vps %vps-test-os run-vps-test)) @@ -193,7 +195,16 @@ every function in TEST-CASES. Each element is a function (let ((claude claude-code-test-cases) (paseo paseo-test-cases) (dots dotfiles-test-cases) - (home home-activation-test-cases)) + (home home-activation-test-cases) + (ssh (lambda (m) + (sshd-test-cases m + (make-ssh-connect m)))) + (net networking-test-cases)) (system-test (name "vps") (description "VPS test suite.") - (value (run-vps-test (list claude paseo dots home)))))) + (value (run-vps-test (list claude + paseo + dots + home + ssh + net))))))