2019-03-24 23:59:09 +01:00
|
|
|
# Test Docker containers as systemd units
|
|
|
|
|
2020-02-13 12:01:38 +01:00
|
|
|
import ./make-test-python.nix ({ pkgs, lib, ... }: {
|
2019-03-24 23:59:09 +01:00
|
|
|
name = "docker-containers";
|
|
|
|
meta = {
|
2020-01-28 22:00:54 +01:00
|
|
|
maintainers = with lib.maintainers; [ benley mkaito ];
|
2019-03-24 23:59:09 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
nodes = {
|
2020-02-13 12:01:38 +01:00
|
|
|
docker = { pkgs, ... }: {
|
|
|
|
virtualisation.docker.enable = true;
|
2019-03-24 23:59:09 +01:00
|
|
|
|
2020-02-13 12:01:38 +01:00
|
|
|
docker-containers.nginx = {
|
|
|
|
image = "nginx-container";
|
|
|
|
imageFile = pkgs.dockerTools.examples.nginx;
|
|
|
|
ports = ["8181:80"];
|
2019-03-24 23:59:09 +01:00
|
|
|
};
|
2020-02-13 12:01:38 +01:00
|
|
|
};
|
2019-03-24 23:59:09 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
testScript = ''
|
2020-02-13 12:01:38 +01: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 23:59:09 +01:00
|
|
|
'';
|
|
|
|
})
|