2018-02-14 05:20:16 +00:00
|
|
|
# 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, ... }: {
|
2018-02-16 17:24:48 +00:00
|
|
|
virtualisation = {
|
|
|
|
diskSize = 1024;
|
|
|
|
docker.enable = true;
|
|
|
|
};
|
2018-02-14 05:20:16 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
testScript =
|
2018-02-16 17:24:48 +00:00
|
|
|
''
|
|
|
|
$docker->waitForUnit("sockets.target");
|
2018-02-14 05:20:16 +00:00
|
|
|
|
2018-02-16 17:24:48 +00:00
|
|
|
$docker->succeed("docker load --input='${pkgs.dockerTools.examples.bash}'");
|
|
|
|
$docker->succeed("docker run ${pkgs.dockerTools.examples.bash.imageName} /bin/bash --version");
|
2018-02-14 05:20:16 +00:00
|
|
|
|
2018-02-16 17:24:48 +00:00
|
|
|
$docker->succeed("docker load --input='${pkgs.dockerTools.examples.nix}'");
|
|
|
|
$docker->succeed("docker run ${pkgs.dockerTools.examples.nix.imageName} /bin/nix-store -qR ${pkgs.nix}");
|
2018-02-14 05:20:16 +00:00
|
|
|
|
2018-02-16 17:24:48 +00:00
|
|
|
# To test the pullImage tool
|
|
|
|
$docker->succeed("docker load --input='${pkgs.dockerTools.examples.nixFromDockerHub}'");
|
|
|
|
$docker->succeed("docker run nixos/nix:1.11 nix-store --version");
|
2018-02-14 05:20:16 +00:00
|
|
|
|
2018-02-16 17:24:48 +00:00
|
|
|
# To test runAsRoot and entry point
|
|
|
|
$docker->succeed("docker load --input='${pkgs.dockerTools.examples.nginx}'");
|
|
|
|
$docker->succeed("docker run --name nginx -d -p 8000:80 ${pkgs.dockerTools.examples.nginx.imageName}");
|
|
|
|
$docker->waitUntilSucceeds('curl http://localhost:8000/');
|
|
|
|
$docker->succeed("docker rm --force nginx");
|
|
|
|
'';
|
2018-02-14 05:20:16 +00:00
|
|
|
})
|