summaryrefslogtreecommitdiff
path: root/gnu/tests/docker.scm
diff options
context:
space:
mode:
authorGiacomo Leidi <goodoldpaul@autistici.org>2025-08-25 09:17:03 +0200
committerMaxim Cournoyer <maxim@guixotic.coop>2025-08-25 17:34:29 +0900
commit1f8ee9e0239d12e80b1682ae0201e98c477b1a9a (patch)
tree4971557041846f2d4c62249200c6b61a360ace11 /gnu/tests/docker.scm
parent93006671b42a702bc0c663eea3968a377eb65c94 (diff)
Revert "tests: Use lower-oci-image-state in container tests."
This reverts commit cc07ecd7ccc52540113414eaebafc0fb218ef9ff, which breaks 'guix pull', for to-be-investigated reasons. Fixes: #2252 Change-Id: Idd02dd2e0cd93034e636030845996a9ab3748839 Signed-off-by: Maxim Cournoyer <maxim@guixotic.coop>
Diffstat (limited to 'gnu/tests/docker.scm')
-rw-r--r--gnu/tests/docker.scm104
1 files changed, 45 insertions, 59 deletions
diff --git a/gnu/tests/docker.scm b/gnu/tests/docker.scm
index 4fc50a99a72..9fee3905f0e 100644
--- a/gnu/tests/docker.scm
+++ b/gnu/tests/docker.scm
@@ -26,7 +26,6 @@
26 #:use-module (gnu system image) 26 #:use-module (gnu system image)
27 #:use-module (gnu system vm) 27 #:use-module (gnu system vm)
28 #:use-module (gnu services) 28 #:use-module (gnu services)
29 #:use-module (gnu services containers)
30 #:use-module (gnu services dbus) 29 #:use-module (gnu services dbus)
31 #:use-module (gnu services networking) 30 #:use-module (gnu services networking)
32 #:use-module (gnu services docker) 31 #:use-module (gnu services docker)
@@ -49,9 +48,6 @@
49 %test-docker-system 48 %test-docker-system
50 %test-oci-container)) 49 %test-oci-container))
51 50
52(define lower-oci-image-state
53 (@@ (gnu services containers) lower-oci-image-state))
54
55(define %docker-os 51(define %docker-os
56 (simple-operating-system 52 (simple-operating-system
57 (service dhcpcd-service-type) 53 (service dhcpcd-service-type)
@@ -61,41 +57,6 @@
61 (service containerd-service-type) 57 (service containerd-service-type)
62 (service docker-service-type))) 58 (service docker-service-type)))
63 59
64(define %docker-tarball
65 (lower-oci-image-state
66 "guile-guest"
67 (packages->manifest
68 (list
69 guile-3.0 guile-json-3
70 (package
71 (name "guest-script")
72 (version "0")
73 (source #f)
74 (build-system trivial-build-system)
75 (arguments
76 (list
77 #:guile guile-3.0
78 #:builder
79 #~(let ((out #$output))
80 (mkdir out)
81 (call-with-output-file (string-append out "/a.scm")
82 (lambda (port)
83 (display "(display \"hello world\n\")" port))))))
84 (synopsis "Display hello world using Guile")
85 (description "This package displays the text \"hello world\" on the
86standard output device and then enters a new line.")
87 (home-page #f)
88 (license license:public-domain))))
89 '(#:entry-point "bin/guile"
90 #:localstatedir? #t
91 #:extra-options (#:image-tag "guile-guest")
92 #:symlinks (("/bin/Guile" -> "bin/guile")
93 ("aa.scm" -> "a.scm")))
94 "guile-guest"
95 (%current-target-system)
96 (%current-system)
97 #f))
98
99(define (run-docker-test docker-tarball) 60(define (run-docker-test docker-tarball)
100 "Load DOCKER-TARBALL as Docker image and run it in a Docker container, 61 "Load DOCKER-TARBALL as Docker image and run it in a Docker container,
101inside %DOCKER-OS." 62inside %DOCKER-OS."
@@ -212,7 +173,40 @@ inside %DOCKER-OS."
212 (gexp->derivation "docker-test" test)) 173 (gexp->derivation "docker-test" test))
213 174
214(define (build-tarball&run-docker-test) 175(define (build-tarball&run-docker-test)
215 (run-docker-test %docker-tarball)) 176 (mlet* %store-monad
177 ((_ (set-grafting #f))
178 (guile (set-guile-for-build (default-guile)))
179 (guest-script-package ->
180 (package
181 (name "guest-script")
182 (version "0")
183 (source #f)
184 (build-system trivial-build-system)
185 (arguments `(#:guile ,guile-3.0
186 #:builder
187 (let ((out (assoc-ref %outputs "out")))
188 (mkdir out)
189 (call-with-output-file (string-append out "/a.scm")
190 (lambda (port)
191 (display "(display \"hello world\n\")" port)))
192 #t)))
193 (synopsis "Display hello world using Guile")
194 (description "This package displays the text \"hello world\" on the
195standard output device and then enters a new line.")
196 (home-page #f)
197 (license license:public-domain)))
198 (profile (profile-derivation (packages->manifest
199 (list guile-3.0 guile-json-3
200 guest-script-package))
201 #:hooks '()
202 #:locales? #f))
203 (tarball (pack:docker-image
204 "docker-pack" profile
205 #:symlinks '(("/bin/Guile" -> "bin/guile")
206 ("aa.scm" -> "a.scm"))
207 #:entry-point "bin/guile"
208 #:localstatedir? #t)))
209 (run-docker-test tarball)))
216 210
217(define %test-docker 211(define %test-docker
218 (system-test 212 (system-test
@@ -221,22 +215,8 @@ inside %DOCKER-OS."
221 (value (build-tarball&run-docker-test)))) 215 (value (build-tarball&run-docker-test))))
222 216
223 217
224(define %docker-system-tarball
225 (lower-oci-image-state
226 "guix-system-guest"
227 (operating-system
228 (inherit (simple-operating-system))
229 ;; Use locales for a single libc to
230 ;; reduce space requirements.
231 (locale-libcs (list glibc)))
232 '()
233 "guix-system-guest"
234 (%current-target-system)
235 (%current-system)
236 #f))
237
238(define (run-docker-system-test tarball) 218(define (run-docker-system-test tarball)
239 "Load TARBALL as Docker image and run it in a Docker container, 219 "Load DOCKER-TARBALL as Docker image and run it in a Docker container,
240inside %DOCKER-OS." 220inside %DOCKER-OS."
241 (define os 221 (define os
242 (marionette-operating-system 222 (marionette-operating-system
@@ -353,15 +333,21 @@ inside %DOCKER-OS."
353 333
354 (gexp->derivation "docker-system-test" test)) 334 (gexp->derivation "docker-system-test" test))
355 335
356(define (build-tarball&run-docker-system-test)
357 (run-docker-system-test %docker-system-tarball))
358
359(define %test-docker-system 336(define %test-docker-system
360 (system-test 337 (system-test
361 (name "docker-system") 338 (name "docker-system")
362 (description "Run a system image as produced by @command{guix system 339 (description "Run a system image as produced by @command{guix system
363docker-image} inside Docker.") 340docker-image} inside Docker.")
364 (value (build-tarball&run-docker-system-test)))) 341 (value (with-monad %store-monad
342 (>>= (lower-object
343 (system-image (os->image
344 (operating-system
345 (inherit (simple-operating-system))
346 ;; Use locales for a single libc to
347 ;; reduce space requirements.
348 (locale-libcs (list glibc)))
349 #:type docker-image-type)))
350 run-docker-system-test)))))
365 351
366 352
367(define %oci-os 353(define %oci-os