me
/
guix
Archived
1
0
Fork 0

tests: docker: Fix it.

The docker tests are broken because the docker overlay doesn't support running
on our own storage overlay. Use the new <virtual-machine> volatile? field to
spawn a VM with a persistent storage and no overlay.

* gnu/tests/docker.scm (run-docker-test): Add the docker-tarball to the gc
roots as the host store is not shared anymore. Spawn a VM without volatile
storage.
(run-docker-system-test): Ditto.
(%test-docker-system): Adapt it to use the image API.
master
Mathieu Othacehe 2021-12-16 13:37:10 +01:00
parent bce55cec88
commit 102c360624
No known key found for this signature in database
GPG Key ID: 8354763531769CA6
1 changed files with 29 additions and 22 deletions

View File

@ -18,9 +18,11 @@
;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>. ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
(define-module (gnu tests docker) (define-module (gnu tests docker)
#:use-module (gnu image)
#:use-module (gnu tests) #:use-module (gnu tests)
#:use-module (gnu system) #:use-module (gnu system)
#:use-module (gnu system file-systems) #:use-module (gnu system file-systems)
#:use-module (gnu system image)
#:use-module (gnu system vm) #:use-module (gnu system vm)
#:use-module (gnu services) #:use-module (gnu services)
#:use-module (gnu services dbus) #:use-module (gnu services dbus)
@ -35,7 +37,7 @@
#:use-module (guix monads) #:use-module (guix monads)
#:use-module (guix packages) #:use-module (guix packages)
#:use-module (guix profiles) #:use-module (guix profiles)
#:use-module (guix scripts pack) #:use-module ((guix scripts pack) #:prefix pack:)
#:use-module (guix store) #:use-module (guix store)
#:use-module (guix tests) #:use-module (guix tests)
#:use-module (guix build-system trivial) #:use-module (guix build-system trivial)
@ -56,15 +58,18 @@
inside %DOCKER-OS." inside %DOCKER-OS."
(define os (define os
(marionette-operating-system (marionette-operating-system
%docker-os (operating-system-with-gc-roots
%docker-os
(list docker-tarball))
#:imported-modules '((gnu services herd) #:imported-modules '((gnu services herd)
(guix combinators)))) (guix combinators))))
(define vm (define vm
(virtual-machine (virtual-machine
(operating-system os) (operating-system os)
(memory-size 700) (volatile? #f)
(disk-image-size (* 1500 (expt 2 20))) (memory-size 1024)
(disk-image-size (* 3000 (expt 2 20)))
(port-forwardings '()))) (port-forwardings '())))
(define test (define test
@ -173,11 +178,12 @@ standard output device and then enters a new line.")
guest-script-package)) guest-script-package))
#:hooks '() #:hooks '()
#:locales? #f)) #:locales? #f))
(tarball (docker-image "docker-pack" profile (tarball (pack:docker-image
#:symlinks '(("/bin/Guile" -> "bin/guile") "docker-pack" profile
("aa.scm" -> "a.scm")) #:symlinks '(("/bin/Guile" -> "bin/guile")
#:entry-point "bin/guile" ("aa.scm" -> "a.scm"))
#:localstatedir? #t))) #:entry-point "bin/guile"
#:localstatedir? #t)))
(run-docker-test tarball))) (run-docker-test tarball)))
(define %test-docker (define %test-docker
@ -192,19 +198,18 @@ standard output device and then enters a new line.")
inside %DOCKER-OS." inside %DOCKER-OS."
(define os (define os
(marionette-operating-system (marionette-operating-system
%docker-os (operating-system-with-gc-roots
%docker-os
(list tarball))
#:imported-modules '((gnu services herd) #:imported-modules '((gnu services herd)
(guix combinators)))) (guix combinators))))
(define vm (define vm
(virtual-machine (virtual-machine
(operating-system os) (operating-system os)
;; FIXME: Because we're using the volatile-root setup where the root file (volatile? #f)
;; system is a tmpfs overlaid over a small root file system, 'docker (disk-image-size (* 5000 (expt 2 20)))
;; load' must be able to store the whole image into memory, hence the (memory-size 2048)
;; huge memory requirements. We should avoid the volatile-root setup
;; instead.
(memory-size 4500)
(port-forwardings '()))) (port-forwardings '())))
(define test (define test
@ -293,10 +298,12 @@ inside %DOCKER-OS."
(description "Run a system image as produced by @command{guix system (description "Run a system image as produced by @command{guix system
docker-image} inside Docker.") docker-image} inside Docker.")
(value (with-monad %store-monad (value (with-monad %store-monad
(>>= (system-docker-image (operating-system (>>= (lower-object
(inherit (simple-operating-system)) (system-image (os->image
;; Use locales for a single libc to (operating-system
;; reduce space requirements. (inherit (simple-operating-system))
(locale-libcs (list glibc))) ;; Use locales for a single libc to
#:memory-size 1024) ;; reduce space requirements.
(locale-libcs (list glibc)))
#:type docker-image-type)))
run-docker-system-test))))) run-docker-system-test)))))