f-50: lab: scénarios E5, configuration de l'agent par hyperviseur, release 0.2.0rc003 #50

Signed-off-by: GnomeZworc <nicolas.boufidjeline@g3e.fr>
This commit is contained in:
GnomeZworc 2026-10-04 20:43:53 +02:00
commit 5728fdd33c
Signed by: nicolas.boufideline
GPG key ID: 4406BBBF8845D632
25 changed files with 760 additions and 27 deletions

View file

@ -385,3 +385,23 @@ func TestPrepare_PutsTheFRRConfigIntoTheSeed(t *testing.T) {
}
t.Errorf("hv1 user-data has no /etc/lab/frr.conf:\n%s", data)
}
func TestReadAgent_ReadsOnlyTheNodesThatDeclareOne(t *testing.T) {
conf := filepath.Join(t.TempDir(), "two.yml")
if err := os.WriteFile(conf, []byte("dhcp:\n backend: two\n"), 0o600); err != nil {
t.Fatal(err)
}
m := newMirror(t)
p := labPlan(t, m)
p.Nodes[2].Agent = conf
got, err := ReadAgent(p)
if err != nil || !reflect.DeepEqual(got, map[string]string{"hv1": "dhcp:\n backend: two\n"}) {
t.Errorf("ReadAgent = %q, %v", got, err)
}
p.Nodes[3].Agent = filepath.Join(t.TempDir(), "absent.yml")
if _, err := ReadAgent(p); err == nil || !strings.Contains(err.Error(), "node hv2: ") {
t.Errorf("error = %v", err)
}
}