nixos/docker: fix module, add simple test
commit40d73c5eb7c9beffea60d34161fd080881760c4a
authorJaka Hudoklin <jakahudoklin@gmail.com>
dateMon 1 Dec 2014, 17:20 (12 years ago)
parent77049af
nixos/modules/virtualisation/docker.nix+2−2
@@ -7,8 +7,8 @@ with lib;
77let
88
99 cfg = config.virtualisation.docker;
10− pro = config.nix.proxy;
11− proxy_env = optionalAttrs (pro != "") { Environment = "\"http_proxy=${pro}\""; };
10+ pro = config.networking.proxy.default;
11+ proxy_env = optionalAttrs (pro != null) { Environment = "\"http_proxy=${pro}\""; };
1212
1313in
1414
nixos/release.nix+1
@@ -239,6 +239,7 @@ in rec {
239239 tests.chromium = callTest tests/chromium.nix {};
240240 tests.cjdns = callTest tests/cjdns.nix {};
241241 tests.containers = callTest tests/containers.nix {};
242+ tests.docker = scrubDrv (import tests/docker.nix { system = "x86_64-linux"; });
242243 tests.dockerRegistry = scrubDrv (import tests/docker-registry.nix { system = "x86_64-linux"; });
243244 tests.etcd = scrubDrv (import tests/etcd.nix { system = "x86_64-linux"; });
244245 tests.firefox = callTest tests/firefox.nix {};
nixos/tests/docker.nixnew file+24
@@ -0,0 +1,24 @@
1+# This test runs docker and checks if simple container starts
2+
3+import ./make-test.nix {
4+ name = "docker";
5+
6+ nodes = {
7+ docker =
8+ { config, pkgs, ... }:
9+ {
10+ virtualisation.docker.enable = true;
11+ };
12+ };
13+
14+ testScript = ''
15+ startAll;
16+
17+ $docker->waitForUnit("docker.service");
18+ $docker->succeed("tar cv --files-from /dev/null | docker import - scratch");
19+ $docker->succeed("docker run -d --name=sleeping -v /nix/store:/nix/store -v /run/current-system/sw/bin:/bin scratch /bin/sleep 10");
20+ $docker->succeed("docker ps | grep sleeping");
21+ $docker->succeed("docker stop sleeping");
22+ '';
23+
24+}