about summary refs log tree commit diff
diff options
context:
space:
mode:
authorProfpatsch <mail@profpatsch.de>2018-02-14 06:20:16 +0100
committerProfpatsch <mail@profpatsch.de>2018-02-14 06:36:14 +0100
commit1545f9062e3252b3001bdb04eaf48d46eb53d041 (patch)
tree7836b4a4f9c623bd9da2548ac51b4b4defafdcf6
parentac8a149e07d014943f7af729b0076e76398f5786 (diff)
downloadnixlib-1545f9062e3252b3001bdb04eaf48d46eb53d041.tar
nixlib-1545f9062e3252b3001bdb04eaf48d46eb53d041.tar.gz
nixlib-1545f9062e3252b3001bdb04eaf48d46eb53d041.tar.bz2
nixlib-1545f9062e3252b3001bdb04eaf48d46eb53d041.tar.lz
nixlib-1545f9062e3252b3001bdb04eaf48d46eb53d041.tar.xz
nixlib-1545f9062e3252b3001bdb04eaf48d46eb53d041.tar.zst
nixlib-1545f9062e3252b3001bdb04eaf48d46eb53d041.zip
nixos/tests: add simple dockerTools test
-rw-r--r--nixos/release.nix1
-rw-r--r--nixos/tests/docker-tools.nix36
2 files changed, 37 insertions, 0 deletions
diff --git a/nixos/release.nix b/nixos/release.nix
index b778258da63d..e473a0804244 100644
--- a/nixos/release.nix
+++ b/nixos/release.nix
@@ -244,6 +244,7 @@ in rec {
   tests.containers-macvlans = callTest tests/containers-macvlans.nix {};
   tests.couchdb = callTest tests/couchdb.nix {};
   tests.docker = callTestOnTheseSystems ["x86_64-linux"] tests/docker.nix {};
+  tests.docker-tools = callTestOnTheseSystems ["x86_64-linux"] tests/docker-tools.nix {};
   tests.docker-edge = callTestOnTheseSystems ["x86_64-linux"] tests/docker-edge.nix {};
   tests.dovecot = callTest tests/dovecot.nix {};
   tests.dnscrypt-proxy = callTestOnTheseSystems ["x86_64-linux"] tests/dnscrypt-proxy.nix {};
diff --git a/nixos/tests/docker-tools.nix b/nixos/tests/docker-tools.nix
new file mode 100644
index 000000000000..e7f2588f681b
--- /dev/null
+++ b/nixos/tests/docker-tools.nix
@@ -0,0 +1,36 @@
+# this test creates a simple GNU image with docker tools and sees if it executes
+
+import ./make-test.nix ({ pkgs, ... }: {
+  name = "docker-tools";
+  meta = with pkgs.stdenv.lib.maintainers; {
+    maintainers = [ ];
+  };
+
+  nodes = {
+    docker =
+      { config, pkgs, ... }: {
+        virtualisation.docker.enable = true;
+      };
+  };
+
+  testScript =
+    let
+      dockerImage = pkgs.dockerTools.buildImage {
+        name = "hello-docker";
+        contents = [ pkgs.hello ];
+        tag = "sometag";
+
+        # TODO: create another test checking whether runAsRoot works as intended.
+
+        config = {
+          Cmd = [ "hello" ];
+        };
+      };
+
+    in ''
+      $docker->waitForUnit("sockets.target");
+      $docker->succeed("docker load --input='${dockerImage}'");
+      $docker->succeed("docker run hello-docker:sometag");
+    '';
+
+})