about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJaka Hudoklin <jakahudoklin@gmail.com>2014-12-01 17:20:18 +0100
committerJaka Hudoklin <jakahudoklin@gmail.com>2014-12-01 17:20:35 +0100
commit40d73c5eb7c9beffea60d34161fd080881760c4a (patch)
tree5b2e4249f8b328236a62dfaece54e2f79a67f041
parent77049af46f122418114ae9751952282d30695bc3 (diff)
downloadnixlib-40d73c5eb7c9beffea60d34161fd080881760c4a.tar
nixlib-40d73c5eb7c9beffea60d34161fd080881760c4a.tar.gz
nixlib-40d73c5eb7c9beffea60d34161fd080881760c4a.tar.bz2
nixlib-40d73c5eb7c9beffea60d34161fd080881760c4a.tar.lz
nixlib-40d73c5eb7c9beffea60d34161fd080881760c4a.tar.xz
nixlib-40d73c5eb7c9beffea60d34161fd080881760c4a.tar.zst
nixlib-40d73c5eb7c9beffea60d34161fd080881760c4a.zip
nixos/docker: fix module, add simple test
-rw-r--r--nixos/modules/virtualisation/docker.nix4
-rw-r--r--nixos/release.nix1
-rw-r--r--nixos/tests/docker.nix24
3 files changed, 27 insertions, 2 deletions
diff --git a/nixos/modules/virtualisation/docker.nix b/nixos/modules/virtualisation/docker.nix
index 9ae9624fd481..5be76b2682f5 100644
--- a/nixos/modules/virtualisation/docker.nix
+++ b/nixos/modules/virtualisation/docker.nix
@@ -7,8 +7,8 @@ with lib;
 let
 
   cfg = config.virtualisation.docker;
-  pro = config.nix.proxy;
-  proxy_env = optionalAttrs (pro != "") { Environment = "\"http_proxy=${pro}\""; };
+  pro = config.networking.proxy.default;
+  proxy_env = optionalAttrs (pro != null) { Environment = "\"http_proxy=${pro}\""; };
 
 in
 
diff --git a/nixos/release.nix b/nixos/release.nix
index 05d64e142294..e0530276b641 100644
--- a/nixos/release.nix
+++ b/nixos/release.nix
@@ -239,6 +239,7 @@ in rec {
   tests.chromium = callTest tests/chromium.nix {};
   tests.cjdns = callTest tests/cjdns.nix {};
   tests.containers = callTest tests/containers.nix {};
+  tests.docker = scrubDrv (import tests/docker.nix { system = "x86_64-linux"; });
   tests.dockerRegistry = scrubDrv (import tests/docker-registry.nix { system = "x86_64-linux"; });
   tests.etcd = scrubDrv (import tests/etcd.nix { system = "x86_64-linux"; });
   tests.firefox = callTest tests/firefox.nix {};
diff --git a/nixos/tests/docker.nix b/nixos/tests/docker.nix
new file mode 100644
index 000000000000..63c909ff294c
--- /dev/null
+++ b/nixos/tests/docker.nix
@@ -0,0 +1,24 @@
+# This test runs docker and checks if simple container starts
+
+import ./make-test.nix {
+  name = "docker";
+
+  nodes = {
+    docker =
+      { config, pkgs, ... }:
+        {
+          virtualisation.docker.enable = true;
+        };
+    };
+
+  testScript = ''
+    startAll;
+
+    $docker->waitForUnit("docker.service");
+    $docker->succeed("tar cv --files-from /dev/null | docker import - scratch");
+    $docker->succeed("docker run -d --name=sleeping -v /nix/store:/nix/store -v /run/current-system/sw/bin:/bin scratch /bin/sleep 10");
+    $docker->succeed("docker ps | grep sleeping");
+    $docker->succeed("docker stop sleeping");
+  '';
+
+}