1 import ./make-test-python.nix ({ pkgs, lib, ... }: {
2 name = "containers-hosts";
4 maintainers = with lib.maintainers; [ montag451 ];
10 virtualisation.vlans = [];
12 networking.bridges.br0.interfaces = [];
13 networking.interfaces.br0.ipv4.addresses = [
14 { address = "10.11.0.254"; prefixLength = 24; }
17 # Force /etc/hosts to be the only source for host name resolution
18 environment.etc."nsswitch.conf".text = lib.mkForce ''
24 privateNetwork = true;
25 localAddress = "10.10.0.1";
26 hostAddress = "10.10.0.254";
31 containers.netmask = {
33 privateNetwork = true;
35 localAddress = "10.11.0.1/24";
43 machine.wait_for_unit("default.target")
45 with subtest("Ping the containers using the entries added in /etc/hosts"):
46 for host in "simple.containers", "netmask.containers":
47 machine.succeed(f"ping -n -c 1 {host}")