2019-03-24 22:59:09 +00:00
|
|
|
# Test Docker containers as systemd units
|
|
|
|
|
2020-02-13 11:01:38 +00:00
|
|
|
import ./make-test-python.nix ({ pkgs, lib, ... }: {
|
2019-03-24 22:59:09 +00:00
|
|
|
name = "docker-containers";
|
|
|
|
meta = {
|
2020-01-28 21:00:54 +00:00
|
|
|
maintainers = with lib.maintainers; [ benley mkaito ];
|
2019-03-24 22:59:09 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
nodes = {
|
2020-02-13 11:01:38 +00:00
|
|
|
docker = { pkgs, ... }: {
|
|
|
|
virtualisation.docker.enable = true;
|
2019-03-24 22:59:09 +00:00
|
|
|
|
2020-02-13 11:01:38 +00:00
|
|
|
docker-containers.nginx = {
|
|
|
|
image = "nginx-container";
|
|
|
|
imageFile = pkgs.dockerTools.examples.nginx;
|
|
|
|
ports = ["8181:80"];
|
2019-03-24 22:59:09 +00:00
|
|
|
};
|
2020-02-13 11:01:38 +00:00
|
|
|
};
|
2019-03-24 22:59:09 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
testScript = ''
|
2020-02-13 11:01:38 +00:00
|
|
|
start_all()
|
|
|
|
docker.wait_for_unit("docker-nginx.service")
|
|
|
|
docker.wait_for_open_port(8181)
|
|
|
|
docker.wait_until_succeeds("curl http://localhost:8181 | grep Hello")
|
2019-03-24 22:59:09 +00:00
|
|
|
'';
|
|
|
|
})
|