diff options
Diffstat (limited to 'gnu/tests/containers.scm')
| -rw-r--r-- | gnu/tests/containers.scm | 84 |
1 files changed, 42 insertions, 42 deletions
diff --git a/gnu/tests/containers.scm b/gnu/tests/containers.scm index 1a442cddc64..089303643c9 100644 --- a/gnu/tests/containers.scm +++ b/gnu/tests/containers.scm | |||
| @@ -46,6 +46,9 @@ | |||
| 46 | %test-oci-service-rootless-podman | 46 | %test-oci-service-rootless-podman |
| 47 | %test-oci-service-docker)) | 47 | %test-oci-service-docker)) |
| 48 | 48 | ||
| 49 | (define lower-oci-image-state | ||
| 50 | (@@ (gnu services containers) lower-oci-image-state)) | ||
| 51 | |||
| 49 | 52 | ||
| 50 | (define %rootless-podman-os | 53 | (define %rootless-podman-os |
| 51 | (simple-operating-system | 54 | (simple-operating-system |
| @@ -69,13 +72,48 @@ | |||
| 69 | (supplementary-groups '("wheel" "netdev" "cgroup" | 72 | (supplementary-groups '("wheel" "netdev" "cgroup" |
| 70 | "audio" "video"))))))) | 73 | "audio" "video"))))))) |
| 71 | 74 | ||
| 72 | (define (run-rootless-podman-test oci-tarball) | 75 | (define %oci-tarball |
| 76 | (lower-oci-image-state | ||
| 77 | "guile-guest" | ||
| 78 | (packages->manifest | ||
| 79 | (list | ||
| 80 | guile-3.0 guile-json-3 | ||
| 81 | (package | ||
| 82 | (name "guest-script") | ||
| 83 | (version "0") | ||
| 84 | (source #f) | ||
| 85 | (build-system trivial-build-system) | ||
| 86 | (arguments | ||
| 87 | (list | ||
| 88 | #:guile guile-3.0 | ||
| 89 | #:builder | ||
| 90 | #~(let ((out #$output)) | ||
| 91 | (mkdir out) | ||
| 92 | (call-with-output-file (string-append out "/a.scm") | ||
| 93 | (lambda (port) | ||
| 94 | (display "(display \"hello world\n\")" port)))))) | ||
| 95 | (synopsis "Display hello world using Guile") | ||
| 96 | (description "This package displays the text \"hello world\" on the | ||
| 97 | standard output device and then enters a new line.") | ||
| 98 | (home-page #f) | ||
| 99 | (license license:public-domain)))) | ||
| 100 | '(#:entry-point "bin/guile" | ||
| 101 | #:localstatedir? #t | ||
| 102 | #:extra-options (#:image-tag "guile-guest") | ||
| 103 | #:symlinks (("/bin/Guile" -> "bin/guile") | ||
| 104 | ("aa.scm" -> "a.scm"))) | ||
| 105 | "guile-guest" | ||
| 106 | (%current-target-system) | ||
| 107 | (%current-system) | ||
| 108 | #f)) | ||
| 109 | |||
| 110 | (define (run-rootless-podman-test) | ||
| 73 | 111 | ||
| 74 | (define os | 112 | (define os |
| 75 | (marionette-operating-system | 113 | (marionette-operating-system |
| 76 | (operating-system-with-gc-roots | 114 | (operating-system-with-gc-roots |
| 77 | %rootless-podman-os | 115 | %rootless-podman-os |
| 78 | (list oci-tarball)) | 116 | (list %oci-tarball)) |
| 79 | #:imported-modules '((gnu services herd) | 117 | #:imported-modules '((gnu services herd) |
| 80 | (guix combinators)))) | 118 | (guix combinators)))) |
| 81 | 119 | ||
| @@ -254,7 +292,7 @@ | |||
| 254 | (let* ((loaded (slurp ,(string-append #$podman | 292 | (let* ((loaded (slurp ,(string-append #$podman |
| 255 | "/bin/podman") | 293 | "/bin/podman") |
| 256 | "load" "-i" | 294 | "load" "-i" |
| 257 | ,#$oci-tarball)) | 295 | ,#$%oci-tarball)) |
| 258 | (repository&tag "localhost/guile-guest:latest") | 296 | (repository&tag "localhost/guile-guest:latest") |
| 259 | (response1 (slurp | 297 | (response1 (slurp |
| 260 | ,(string-append #$podman "/bin/podman") | 298 | ,(string-append #$podman "/bin/podman") |
| @@ -307,49 +345,11 @@ | |||
| 307 | 345 | ||
| 308 | (gexp->derivation "rootless-podman-test" test)) | 346 | (gexp->derivation "rootless-podman-test" test)) |
| 309 | 347 | ||
| 310 | (define (build-tarball&run-rootless-podman-test) | ||
| 311 | (mlet* %store-monad | ||
| 312 | ((_ (set-grafting #f)) | ||
| 313 | (guile (set-guile-for-build (default-guile))) | ||
| 314 | (guest-script-package -> | ||
| 315 | (package | ||
| 316 | (name "guest-script") | ||
| 317 | (version "0") | ||
| 318 | (source #f) | ||
| 319 | (build-system trivial-build-system) | ||
| 320 | (arguments `(#:guile ,guile-3.0 | ||
| 321 | #:builder | ||
| 322 | (let ((out (assoc-ref %outputs "out"))) | ||
| 323 | (mkdir out) | ||
| 324 | (call-with-output-file (string-append out "/a.scm") | ||
| 325 | (lambda (port) | ||
| 326 | (display "(display \"hello world\n\")" port))) | ||
| 327 | #t))) | ||
| 328 | (synopsis "Display hello world using Guile") | ||
| 329 | (description "This package displays the text \"hello world\" on the | ||
| 330 | standard output device and then enters a new line.") | ||
| 331 | (home-page #f) | ||
| 332 | (license license:public-domain))) | ||
| 333 | (profile (profile-derivation (packages->manifest | ||
| 334 | (list guile-3.0 guile-json-3 | ||
| 335 | guest-script-package)) | ||
| 336 | #:hooks '() | ||
| 337 | #:locales? #f)) | ||
| 338 | (tarball (pack:docker-image | ||
| 339 | "docker-pack" profile | ||
| 340 | #:symlinks '(("/bin/Guile" -> "bin/guile") | ||
| 341 | ("aa.scm" -> "a.scm")) | ||
| 342 | #:extra-options | ||
| 343 | '(#:image-tag "guile-guest") | ||
| 344 | #:entry-point "bin/guile" | ||
| 345 | #:localstatedir? #t))) | ||
| 346 | (run-rootless-podman-test tarball))) | ||
| 347 | |||
| 348 | (define %test-rootless-podman | 348 | (define %test-rootless-podman |
| 349 | (system-test | 349 | (system-test |
| 350 | (name "rootless-podman") | 350 | (name "rootless-podman") |
| 351 | (description "Test rootless Podman service.") | 351 | (description "Test rootless Podman service.") |
| 352 | (value (build-tarball&run-rootless-podman-test)))) | 352 | (value (run-rootless-podman-test)))) |
| 353 | 353 | ||
| 354 | 354 | ||
| 355 | (define %oci-network | 355 | (define %oci-network |
