Files
mesh-catalog/modules/systemd-networkd/cmd/uplink-tools/manager_test.go
T
jochen c619a672a3
mesh/merge-gate pass: builds networkmanager, systemd-networkd, sent nowhere; no bus step; 4 wait(s) for a person; every machine composes with the change as…
mesh/repo-check pass: its merge-check.sh passed
mesh/delivery delivered
mesh/delivery-group group feat/node-uplink-verbs delivered: every member is delivered
Serve the uplink seat's verbs from both of its holders (hq ADR 0241)
What a machine resolves through had no tool: the resolver file and who
wrote it, and every link with its default route and the resolvers its
manager knows. Each holder serves the same two node-uplink verbs; the
reading is one text carried by both, held to it by a test, and only
asking the manager for a link's names is each holder's own.
2026-10-07 19:19:52 +02:00

30 lines
1.0 KiB
Go

package main
import "testing"
// systemd-networkd's word on each link's names, read from `networkctl status --all`.
func TestNetworkctlIsReadPerLink(t *testing.T) {
out := `● 1: lo
Link File: n/a
Network File: n/a
State: carrier (unmanaged)
● 2: eth0
Link File: /usr/lib/systemd/network/99-default.link
Network File: /etc/systemd/network/20-wired.network
State: routable (configured)
Address: 198.51.100.7
Gateway: 198.51.100.1
DNS: 198.51.100.53
198.51.100.54
Search Domains: example.net lab.example
Activation Policy: up
`
links := parseNetworkctl(out)
eth := links["eth0"]
if len(links) != 1 || len(eth.Servers) != 2 || eth.Servers[1] != "198.51.100.54" || len(eth.Domains) != 2 ||
eth.State != "routable (configured)" || eth.Manager != "systemd-networkd" {
t.Fatalf("read %+v", links)
}
}