diff options
author | adisbladis <adisbladis@gmail.com> | 2020-04-20 12:31:07 +0100 |
---|---|---|
committer | adisbladis <adisbladis@gmail.com> | 2020-05-04 13:47:25 +0100 |
commit | 2f7747526cc80844a506c4aa14706429324be157 (patch) | |
tree | e5e61dd3873c02c23cced6afbc79c7be45294d8e /nixos/tests/oci-containers.nix | |
parent | 2fb5dac372fedd482ef3c65b608810bb7dd45083 (diff) | |
download | nixpkgs-2f7747526cc80844a506c4aa14706429324be157.tar nixpkgs-2f7747526cc80844a506c4aa14706429324be157.tar.gz nixpkgs-2f7747526cc80844a506c4aa14706429324be157.tar.bz2 nixpkgs-2f7747526cc80844a506c4aa14706429324be157.tar.lz nixpkgs-2f7747526cc80844a506c4aa14706429324be157.tar.xz nixpkgs-2f7747526cc80844a506c4aa14706429324be157.tar.zst nixpkgs-2f7747526cc80844a506c4aa14706429324be157.zip |
nixos/docker-containers: Rename to virtualisation.oci-containers.containers.
And allow the runtime to be configurable via the `virtualisation.oci-containers.backend` option. Valid choices are "podman" and "docker".
Diffstat (limited to 'nixos/tests/oci-containers.nix')
-rw-r--r-- | nixos/tests/oci-containers.nix | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/nixos/tests/oci-containers.nix b/nixos/tests/oci-containers.nix new file mode 100644 index 00000000000..bb6c019f07c --- /dev/null +++ b/nixos/tests/oci-containers.nix @@ -0,0 +1,43 @@ +{ 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 = { + maintainers = with lib.maintainers; [ adisbladis benley mkaito ]; + }; + + 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) + ${backend}.wait_until_succeeds("curl http://localhost:8181 | grep Hello") + ''; + }; + +in +lib.foldl' (attrs: backend: attrs // { ${backend} = mkOCITest backend; }) {} [ + "docker" + "podman" +] |