package agent import ( "testing" llmgwv1 "gitea.mynodes.xyz/ilker/llmgw/api/gen/llmgw/v1" "gitea.mynodes.xyz/ilker/llmgw/internal/agent/engines" ) func TestAnEngineDisabledOnTheNodeIsNeitherInstalledNorAdvertised(t *testing.T) { a := &Agent{} a.cfg.Engines.Disabled = []string{"vllm"} a.setProvision(&llmgwv1.Provision{Engines: []*llmgwv1.EngineWant{ {Engine: "llamacpp", Version: "b1"}, {Engine: "vllm", Version: "0.30.0"}, }}) if len(a.provWants) != 1 || a.provWants[0].Engine != "llamacpp" { t.Errorf("wants %+v: vLLM is disabled here and must not be installed", a.provWants) } a.configuredVers = map[string]string{"vllm": "0.25.0"} a.installedVers = map[string]string{"llamacpp": "b1"} if got := a.engineReportLocked(); got["vllm"] != "" || got["llamacpp"] != "b1" { t.Errorf("advertised %v: a disabled engine found on disk is still not offered", got) } } func TestAnEngineNamedByHandIsNotInstalledOverIt(t *testing.T) { a := &Agent{reg: engines.NewRegistry(engines.Config{LlamaCpp: engines.LlamaCppConfig{Bin: "/opt/own/llama-server"}})} a.setProvision(&llmgwv1.Provision{Engines: []*llmgwv1.EngineWant{{Engine: "llamacpp", Version: "b1"}}}) if len(a.provWants) != 0 { t.Errorf("wants %+v: an installed build would be used over the operator's own", a.provWants) } }