package agentsvc import ( "log/slog" "testing" "gitea.mynodes.xyz/ilker/llmgw/internal/control/inventory" ) func TestEachNodeIsToldItsOwnAgentSettings(t *testing.T) { s := New(inventory.NewStore(), nil, false, slog.New(slog.DiscardHandler)) if s.agentSettingsMsg("n1") != nil { t.Error("told settings with nothing to read them from") } s.SetAgentSettings(func(node string) string { if node == "cuda01" { return "labels:\n gpu: rtx6000\n" } return "" }) if got := s.agentSettingsMsg("cuda01").GetAgentSettings().GetYaml(); got != "labels:\n gpu: rtx6000\n" { t.Errorf("cuda01 told %q", got) } // None is said too, so an agent whose settings were removed drops them. if m := s.agentSettingsMsg("node01"); m == nil || m.GetAgentSettings().GetYaml() != "" { t.Errorf("node01 told %v", m) } }