nixosTests.clatd: use runTest and drop unneeded config from client

This commit is contained in:
Jared Baur
2025-03-17 13:52:37 -07:00
parent 300efce181
commit ec19e7420c
2 changed files with 167 additions and 185 deletions

View File

@@ -264,7 +264,7 @@ in {
cinnamon = handleTest ./cinnamon.nix {};
cinnamon-wayland = handleTest ./cinnamon-wayland.nix {};
cjdns = handleTest ./cjdns.nix {};
clatd = handleTest ./clatd.nix {};
clatd = runTest ./clatd.nix;
clickhouse = handleTest ./clickhouse.nix {};
cloud-init = handleTest ./cloud-init.nix {};
cloud-init-hostname = handleTest ./cloud-init-hostname.nix {};

View File

@@ -26,17 +26,15 @@
# | Route: 192.0.2.0/24 via 100.64.0.1
# +------
import ./make-test-python.nix (
{ pkgs, lib, ... }:
{ lib, ... }:
{
{
name = "clatd";
meta = with pkgs.lib.maintainers; {
maintainers = [
meta.maintainers = with lib.maintainers; [
hax404
jmbaur
];
};
nodes = {
# The server is configured with static IPv4 addresses. RFC 6052 Section 3.1
@@ -179,7 +177,9 @@ import ./make-test-python.nix (
# server, the client starts the clat daemon which starts and configures the
# local IPv4 -> IPv6 translation via Tayga after discovering the PLAT
# prefix via DNS64.
client = {
client =
{ pkgs, ... }:
{
virtualisation.vlans = [
3 # towards router
];
@@ -193,28 +193,11 @@ import ./make-test-python.nix (
enable = true;
networks."vlan1" = {
matchConfig.Name = "eth1";
# NOTE: clatd does not actually use the PREF64 prefix discovered by
# systemd-networkd (nor does systemd-networkd do anything with it,
# yet), but we set this to confirm it works. See the test script
# below.
ipv6AcceptRAConfig.UsePREF64 = true;
};
};
services.clatd = {
enable = true;
# NOTE: Perl's Net::DNS resolver does not seem to work well querying
# for AAAA records to systemd-resolved's default IPv4 bind address
# (127.0.0.53), so we add an IPv6 listener address to systemd-resolved
# and tell clatd to use that instead.
settings.dns64-servers = "::1";
};
# Allow clatd to find dns server. See comment above.
services.resolved.extraConfig = ''
DNSStubListenerExtra=::1
'';
services.clatd.enable = true;
environment.systemPackages = [ pkgs.mtr ];
};
@@ -227,7 +210,7 @@ import ./make-test-python.nix (
# wait for all machines to start up
for machine in client, router, server:
machine.wait_for_unit("network-online.target")
machine.wait_for_unit("network.target")
with subtest("Wait for tayga and clatd"):
router.wait_for_unit("tayga.service")
@@ -243,12 +226,11 @@ import ./make-test-python.nix (
]["PREF64"][0]["Prefix"] == [0x0, 0x64, 0xFF, 0x9B] + ([0] * 12)
with subtest("Test ICMP"):
client.wait_until_succeeds("ping -c 3 100.64.0.2 >&2")
client.wait_until_succeeds("ping -c3 100.64.0.2 >&2")
with subtest("Test ICMP and show a traceroute"):
client.wait_until_succeeds("mtr --show-ips --report-wide 100.64.0.2 >&2")
client.log(client.execute("systemd-analyze security clatd.service")[1])
'';
}
)
}