summaryrefslogtreecommitdiff
path: root/gnu/tests
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2021-12-21 15:12:34 +0100
committerLudovic Courtès <ludo@gnu.org>2021-12-21 15:47:04 +0100
commit3b3bef3e4e3a8f38e8686262cd12e1786a9ac2b0 (patch)
tree1c2023d5dff7cb2e8be9e51a04179039f08a97e1 /gnu/tests
parentc9d92409d4d3f587f73c6f48f845a913f7278ad1 (diff)
tests: rsync: Define several modules.
* gnu/tests/rsync.scm (run-rsync-test)["Test file not copied to read-only share", "Test file correctly received from read-only share"]: New tests. (%rsync-os): Define two modules.
Diffstat (limited to 'gnu/tests')
-rw-r--r--gnu/tests/rsync.scm40
1 files changed, 39 insertions, 1 deletions
diff --git a/gnu/tests/rsync.scm b/gnu/tests/rsync.scm
index 91f2b41cec5..079a898cdc8 100644
--- a/gnu/tests/rsync.scm
+++ b/gnu/tests/rsync.scm
@@ -1,6 +1,7 @@
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 © 2018 Clément Lassieur <clement@lassieur.org> 3;;; Copyright © 2018 Clément Lassieur <clement@lassieur.org>
4;;; Copyright © 2021 Ludovic Courtès <ludo@gnu.org>
4;;; 5;;;
5;;; This file is part of GNU Guix. 6;;; This file is part of GNU Guix.
6;;; 7;;;
@@ -104,6 +105,35 @@ PORT."
104 (read-line port)))) 105 (read-line port))))
105 marionette)) 106 marionette))
106 107
108 (test-equal "Test file not copied to read-only share"
109 10 ;see "EXIT VALUES" in rsync(1)
110 (marionette-eval
111 '(status:exit-val
112 (system* "rsync" "/tmp/input"
113 (string-append "rsync://localhost:"
114 (number->string #$rsync-port)
115 "/read-only/input")))
116 marionette))
117
118 (test-equal "Test file correctly received from read-only share"
119 "\"Hi!\" from the read-only share."
120 (marionette-eval
121 '(begin
122 (use-modules (ice-9 rdelim))
123
124 (call-with-output-file "/srv/read-only/the-file"
125 (lambda (port)
126 (display "\"Hi!\" from the read-only share." port)))
127
128 (zero?
129 (system* "rsync"
130 (string-append "rsync://localhost:"
131 (number->string #$rsync-port)
132 "/read-only/the-file")
133 "/tmp/output"))
134 (call-with-input-file "/tmp/output" read-line))
135 marionette))
136
107 (test-end)))) 137 (test-end))))
108 138
109 (gexp->derivation "rsync-test" test)) 139 (gexp->derivation "rsync-test" test))
@@ -113,7 +143,15 @@ PORT."
113 (let ((base-os 143 (let ((base-os
114 (simple-operating-system 144 (simple-operating-system
115 (service dhcp-client-service-type) 145 (service dhcp-client-service-type)
116 (service rsync-service-type)))) 146 (service rsync-service-type
147 (rsync-configuration
148 (modules (list (rsync-module
149 (name "read-only")
150 (file-name "/srv/read-only"))
151 (rsync-module
152 (name "files")
153 (file-name "/srv/read-write")
154 (read-only? #f)))))))))
117 (operating-system 155 (operating-system
118 (inherit base-os) 156 (inherit base-os)
119 (packages (cons* rsync 157 (packages (cons* rsync