[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
branch master updated: tests: Add "nfs-root-fs" system test.
From: |
guix-commits |
Subject: |
branch master updated: tests: Add "nfs-root-fs" system test. |
Date: |
Mon, 07 Sep 2020 09:32:35 -0400 |
This is an automated email from the git hooks/post-receive script.
dannym pushed a commit to branch master
in repository guix.
The following commit(s) were added to refs/heads/master by this push:
new a1a39ed tests: Add "nfs-root-fs" system test.
a1a39ed is described below
commit a1a39ed5a46044161a71cbe6931c7e3006a82ecb
Author: Stefan <stefan-guix@vodafonemail.de>
AuthorDate: Mon Sep 7 14:50:52 2020 +0200
tests: Add "nfs-root-fs" system test.
* gnu/tests/nfs.scm (run-nfs-root-fs-test): New procedure.
(%test-nfs-root-fs): New variable. Export it.
Signed-off-by: Danny Milosavljevic <dannym@scratchpost.org>
---
gnu/tests/nfs.scm | 103 +++++++++++++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 102 insertions(+), 1 deletion(-)
diff --git a/gnu/tests/nfs.scm b/gnu/tests/nfs.scm
index 5e4de27..f632841 100644
--- a/gnu/tests/nfs.scm
+++ b/gnu/tests/nfs.scm
@@ -39,7 +39,8 @@
#:use-module (guix store)
#:use-module (guix monads)
#:export (%test-nfs
- %test-nfs-server))
+ %test-nfs-server
+ %test-nfs-root-fs))
(define %base-os
(operating-system
@@ -262,3 +263,103 @@
(description "Test that an NFS server can be started and exported
directories can be mounted.")
(value (run-nfs-server-test))))
+
+(define (run-nfs-root-fs-test)
+ "Run a test of an OS mounting its root file system via NFS."
+ (define nfs-root-server-os
+ (marionette-operating-system
+ (operating-system
+ (inherit %nfs-os)
+ (file-systems %base-file-systems)
+ (services
+ (modify-services (operating-system-user-services %nfs-os)
+ (nfs-service-type
+ config
+ =>
+ (nfs-configuration
+ (debug '(nfs nfsd mountd))
+ (exports '(("/export"
+
"*(rw,insecure,no_subtree_check,crossmnt,fsid=root,no_root_squash,insecure,async)"))))))))
+ #:requirements '(nscd)
+ #:imported-modules '((gnu services herd)
+ (guix combinators))))
+
+ (define nfs-root-client-os
+ (marionette-operating-system
+ (operating-system
+ (inherit %nfs-os)
+ (kernel-arguments '("ip=dhcp"))
+ (file-systems (cons
+ (file-system
+ (type "nfs")
+ (mount-point "/")
+ (device ":/export")
+ (options "addr=0.0.0.0,vers=4.2"))
+ %base-file-systems)))
+ #:requirements '(nscd)
+ #:imported-modules '((gnu services herd)
+ (guix combinators))))
+
+ (define test
+ (with-imported-modules '((gnu build marionette))
+ #~(begin
+ (use-modules (gnu build marionette)
+ (srfi srfi-64))
+
+ (mkdir "/tmp/server")
+ (define server-marionette
+ (make-marionette (list #$(virtual-machine nfs-root-server-os))
#:socket-directory "/tmp/server"))
+ (define client-marionette
+ (make-marionette (list #$(virtual-machine nfs-root-client-os))))
+
+ (mkdir #$output)
+ (chdir #$output)
+
+ (test-begin "start-nfs-root-server")
+ (marionette-eval
+ '(begin
+ (use-modules (gnu services herd))
+
+ (current-output-port
+ (open-file "/dev/console" "w0"))
+ (chmod "/export" #o777)
+ (symlink "/gnu" "/export/gnu")
+ (start-service 'nscd)
+ (start-service 'networking)
+ (start-service 'nfs))
+ server-marionette)
+
+ ;; Wait for the NFS services to be up and running.
+ (test-assert "nfs services are running"
+ (wait-for-file "/var/run/rpc.statd.pid" server-marionette))
+
+ (test-begin "boot-nfs-root-client")
+ (marionette-eval
+ '(begin
+ (use-modules (gnu services herd))
+
+ (current-output-port
+ (open-file "/dev/console" "w0"))
+ (with-output-to-file "/var/run/mounts"
+ (lambda () (system* "mount")))
+ (chmod "/var/run/mounts" #o777))
+ client-marionette)
+
+ (test-assert "nfs-root-client booted")
+ (marionette-eval
+ '(begin
+ (and (file-exists? "/export/var/run/mounts")
+ (system* "cat" "/export/var/run/mounts")))
+ server-marionette)
+
+ (test-end)
+ (exit (= (test-runner-fail-count (test-runner-current)) 0)))))
+
+ (gexp->derivation "nfs-server-test" test))
+
+(define %test-nfs-root-fs
+ (system-test
+ (name "nfs-root-fs")
+ (description "Test that an NFS server can be started and exported
+directories can be mounted.")
+ (value (run-nfs-root-fs-test))))
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- branch master updated: tests: Add "nfs-root-fs" system test.,
guix-commits <=