nixos/docker: fix module, add simple test

This commit is contained in:
Jaka Hudoklin 2014-12-01 17:20:18 +01:00
parent 77049af46f
commit 40d73c5eb7
3 changed files with 27 additions and 2 deletions

View File

@ -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

View File

@ -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 {};

24
nixos/tests/docker.nix Normal file
View File

@ -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");
'';
}