nixos/tests: add simple dockerTools test

+37
+1
nixos/release.nix
··· 244 tests.containers-macvlans = callTest tests/containers-macvlans.nix {}; 245 tests.couchdb = callTest tests/couchdb.nix {}; 246 tests.docker = callTestOnTheseSystems ["x86_64-linux"] tests/docker.nix {}; 247 tests.docker-edge = callTestOnTheseSystems ["x86_64-linux"] tests/docker-edge.nix {}; 248 tests.dovecot = callTest tests/dovecot.nix {}; 249 tests.dnscrypt-proxy = callTestOnTheseSystems ["x86_64-linux"] tests/dnscrypt-proxy.nix {};
··· 244 tests.containers-macvlans = callTest tests/containers-macvlans.nix {}; 245 tests.couchdb = callTest tests/couchdb.nix {}; 246 tests.docker = callTestOnTheseSystems ["x86_64-linux"] tests/docker.nix {}; 247 + tests.docker-tools = callTestOnTheseSystems ["x86_64-linux"] tests/docker-tools.nix {}; 248 tests.docker-edge = callTestOnTheseSystems ["x86_64-linux"] tests/docker-edge.nix {}; 249 tests.dovecot = callTest tests/dovecot.nix {}; 250 tests.dnscrypt-proxy = callTestOnTheseSystems ["x86_64-linux"] tests/dnscrypt-proxy.nix {};
+36
nixos/tests/docker-tools.nix
···
··· 1 + # this test creates a simple GNU image with docker tools and sees if it executes 2 + 3 + import ./make-test.nix ({ pkgs, ... }: { 4 + name = "docker-tools"; 5 + meta = with pkgs.stdenv.lib.maintainers; { 6 + maintainers = [ ]; 7 + }; 8 + 9 + nodes = { 10 + docker = 11 + { config, pkgs, ... }: { 12 + virtualisation.docker.enable = true; 13 + }; 14 + }; 15 + 16 + testScript = 17 + let 18 + dockerImage = pkgs.dockerTools.buildImage { 19 + name = "hello-docker"; 20 + contents = [ pkgs.hello ]; 21 + tag = "sometag"; 22 + 23 + # TODO: create another test checking whether runAsRoot works as intended. 24 + 25 + config = { 26 + Cmd = [ "hello" ]; 27 + }; 28 + }; 29 + 30 + in '' 31 + $docker->waitForUnit("sockets.target"); 32 + $docker->succeed("docker load --input='${dockerImage}'"); 33 + $docker->succeed("docker run hello-docker:sometag"); 34 + ''; 35 + 36 + })