2020-05-15 21:57:56 +00:00
|
|
|
{ system ? builtins.currentSystem
|
|
|
|
, config ? {}
|
|
|
|
, pkgs ? import ../.. { inherit system config; }
|
|
|
|
, lib ? pkgs.lib
|
|
|
|
}:
|
|
|
|
|
|
|
|
let
|
|
|
|
|
|
|
|
inherit (import ../lib/testing-python.nix { inherit system pkgs; }) makeTest;
|
|
|
|
|
|
|
|
mkOCITest = backend: makeTest {
|
|
|
|
name = "oci-containers-${backend}";
|
|
|
|
|
|
|
|
meta = {
|
2021-05-20 23:08:51 +00:00
|
|
|
maintainers = with lib.maintainers; [ adisbladis benley ] ++ lib.teams.serokell.members;
|
2020-05-15 21:57:56 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
nodes = {
|
|
|
|
${backend} = { pkgs, ... }: {
|
|
|
|
virtualisation.oci-containers = {
|
|
|
|
inherit backend;
|
|
|
|
containers.nginx = {
|
|
|
|
image = "nginx-container";
|
|
|
|
imageFile = pkgs.dockerTools.examples.nginx;
|
|
|
|
ports = ["8181:80"];
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
testScript = ''
|
|
|
|
start_all()
|
|
|
|
${backend}.wait_for_unit("${backend}-nginx.service")
|
|
|
|
${backend}.wait_for_open_port(8181)
|
2020-10-27 00:29:36 +00:00
|
|
|
${backend}.wait_until_succeeds("curl -f http://localhost:8181 | grep Hello")
|
2020-05-15 21:57:56 +00:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
in
|
|
|
|
lib.foldl' (attrs: backend: attrs // { ${backend} = mkOCITest backend; }) {} [
|
|
|
|
"docker"
|
|
|
|
"podman"
|
|
|
|
]
|