diff options
author | zowoq <59103226+zowoq@users.noreply.github.com> | 2022-11-06 10:28:37 +1000 |
---|---|---|
committer | zowoq <59103226+zowoq@users.noreply.github.com> | 2022-11-07 14:11:34 +1000 |
commit | bbfdc6ce4d312b56aa57b38f23c88d339430b38c (patch) | |
tree | badee9919a7ad3e7bc76da3d8d5bd87409ff8f78 /nixos | |
parent | 7a3b60394b20637bff664e94a07f2f37f29e36a0 (diff) |
nixos/tests/podman: move docker tests to separate node
Diffstat (limited to 'nixos')
-rw-r--r-- | nixos/tests/podman/default.nix | 69 |
1 files changed, 34 insertions, 35 deletions
diff --git a/nixos/tests/podman/default.nix b/nixos/tests/podman/default.nix index 67c7823c5a316..44da1410918a0 100644 --- a/nixos/tests/podman/default.nix +++ b/nixos/tests/podman/default.nix @@ -1,5 +1,3 @@ -# This test runs podman and checks if simple container starts - import ../make-test-python.nix ( { pkgs, lib, ... }: { name = "podman"; @@ -8,31 +6,31 @@ import ../make-test-python.nix ( }; nodes = { - podman = - { pkgs, ... }: - { - virtualisation.podman.enable = true; - - # To test docker socket support - virtualisation.podman.dockerSocket.enable = true; - environment.systemPackages = [ - pkgs.docker-client - ]; - - users.users.alice = { - isNormalUser = true; - home = "/home/alice"; - description = "Alice Foobar"; - extraGroups = [ "podman" ]; - }; - - users.users.mallory = { - isNormalUser = true; - home = "/home/mallory"; - description = "Mallory Foobar"; - }; + podman = { pkgs, ... }: { + virtualisation.podman.enable = true; + + users.users.alice = { + isNormalUser = true; + }; + }; + docker = { pkgs, ... }: { + virtualisation.podman.enable = true; + + virtualisation.podman.dockerSocket.enable = true; + + environment.systemPackages = [ + pkgs.docker-client + ]; + users.users.alice = { + isNormalUser = true; + extraGroups = [ "podman" ]; }; + + users.users.mallory = { + isNormalUser = true; + }; + }; }; testScript = '' @@ -45,6 +43,7 @@ import ../make-test-python.nix ( podman.wait_for_unit("sockets.target") + docker.wait_for_unit("sockets.target") start_all() with subtest("Run container as root with runc"): @@ -120,22 +119,22 @@ import ../make-test-python.nix ( assert pid == "2" with subtest("A podman member can use the docker cli"): - podman.succeed(su_cmd("docker version")) + docker.succeed(su_cmd("docker version")) with subtest("Run container via docker cli"): - podman.succeed("docker network create default") - podman.succeed("tar cv --files-from /dev/null | podman import - scratchimg") - podman.succeed( + docker.succeed("docker network create default") + docker.succeed("tar cv --files-from /dev/null | podman import - scratchimg") + docker.succeed( "docker run -d --name=sleeping -v /nix/store:/nix/store -v /run/current-system/sw/bin:/bin localhost/scratchimg /bin/sleep 10" ) - podman.succeed("docker ps | grep sleeping") - podman.succeed("podman ps | grep sleeping") - podman.succeed("docker stop sleeping") - podman.succeed("docker rm sleeping") - podman.succeed("docker network rm default") + docker.succeed("docker ps | grep sleeping") + docker.succeed("podman ps | grep sleeping") + docker.succeed("docker stop sleeping") + docker.succeed("docker rm sleeping") + docker.succeed("docker network rm default") with subtest("A podman non-member can not use the docker cli"): - podman.fail(su_cmd("docker version", user="mallory")) + docker.fail(su_cmd("docker version", user="mallory")) # TODO: add docker-compose test |