Skip to content

Commit

Permalink
nixos/tests: systemd-resolved in stage 1
Browse files Browse the repository at this point in the history
  • Loading branch information
ElvishJerricco committed May 22, 2024
1 parent 072054c commit bfdba4d
Showing 1 changed file with 21 additions and 6 deletions.
27 changes: 21 additions & 6 deletions nixos/tests/systemd-resolved.nix
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,14 @@ import ./make-test-python.nix ({ pkgs, lib, ... }: {
networking.useNetworkd = true;
networking.useDHCP = false;
systemd.network.networks."40-eth0".enable = false;

testing.initrdBackdoor = true;
boot.initrd = {
systemd.enable = true;
systemd.initrdBin = [ pkgs.iputils ];
network.enable = true;
services.resolved.enable = true;
};
};

testScript = { nodes, ... }: let
Expand All @@ -49,12 +57,19 @@ import ./make-test-python.nix ({ pkgs, lib, ... }: {
in ''
start_all()
server.wait_for_unit("multi-user.target")
client.wait_for_unit("multi-user.target")
query = client.succeed("resolvectl query example.com")
assert "${address4}" in query
assert "${address6}" in query
client.succeed("ping -4 -c 1 example.com")
client.succeed("ping -6 -c 1 example.com")
def test_client():
query = client.succeed("resolvectl query example.com")
assert "${address4}" in query
assert "${address6}" in query
client.succeed("ping -4 -c 1 example.com")
client.succeed("ping -6 -c 1 example.com")
client.wait_for_unit("initrd.target")
test_client()
client.switch_root()
client.wait_for_unit("multi-user.target")
test_client()
'';
})

0 comments on commit bfdba4d

Please sign in to comment.