f-57: dhcp: écoute sur le macvlan de la gateway anycast, dnsmasq et serveur intégré #57

Signed-off-by: GnomeZworc <nicolas.boufidjeline@g3e.fr>
This commit is contained in:
GnomeZworc 2026-10-13 14:51:40 +02:00
commit 12d69798fb
Signed by: nicolas.boufideline
GPG key ID: 4406BBBF8845D632
9 changed files with 116 additions and 4 deletions

View file

@ -316,3 +316,27 @@ func TestGenerateConfig_MissingInterfaceIPIsAnError(t *testing.T) {
t.Error("sans interface_ip aucune route metadata n'est possible : il faut échouer, pas écrire une conf muette")
}
}
func TestGenerateConfig_ListensOnTheAnycastGateway(t *testing.T) {
conf := newConf(t, "192.168.1.0/29")
conf.Listen = "gw-s9r1"
conf.Except = "br-s9r1"
path, _, _ := GenerateConfig(conf)
content, _ := os.ReadFile(path)
for _, line := range []string{"\ninterface=gw-s9r1\n", "\nexcept-interface=br-s9r1\n"} {
if !strings.Contains(string(content), line) {
t.Errorf("%q absente du fichier généré :\n%s", strings.TrimSpace(line), content)
}
}
}
func TestGenerateConfig_NoInterfaceLinesByDefault(t *testing.T) {
conf := newConf(t, "192.168.1.0/29")
path, _, _ := GenerateConfig(conf)
content, _ := os.ReadFile(path)
if strings.Contains(string(content), "interface=") {
t.Errorf("aucune directive d'interface attendue sans Listen :\n%s", content)
}
}