1 import ../make-test-python.nix (
4 inherit (pkgs) writeTextDir python3 curl;
5 webroot = writeTextDir "index.html" "<h1>Hi</h1>";
8 name = "podman-dnsname";
10 maintainers = with lib.maintainers; [ roberth ] ++ lib.teams.podman.members;
14 podman = { pkgs, ... }: {
15 virtualisation.podman.enable = true;
16 virtualisation.podman.defaultNetwork.dnsname.enable = true;
21 podman.wait_for_unit("sockets.target")
23 with subtest("DNS works"): # also tests inter-container tcp routing
24 podman.succeed("tar cv --files-from /dev/null | podman import - scratchimg")
26 "podman run -d --name=webserver -v /nix/store:/nix/store -v /run/current-system/sw/bin:/bin -w ${webroot} scratchimg ${python3}/bin/python -m http.server 8000"
28 podman.succeed("podman ps | grep webserver")
30 for i in `seq 0 120`; do
31 podman run --rm --name=client -v /nix/store:/nix/store -v /run/current-system/sw/bin:/bin scratchimg ${curl}/bin/curl http://webserver:8000 >/dev/console \
37 podman.succeed("podman stop webserver")
38 podman.succeed("podman rm webserver")