package catalog import ( "strings" "testing" ) func TestKVEventsReachTheEngineAndTheRouter(t *testing.T) { c, err := New([]Model{model("m", Profile{Name: "p", GPUClass: "h100-80g", TP: 1, KVEvents: true})}) if err != nil { t.Fatal(err) } m, _ := c.Resolve("m") if !m.KVIndex() { t.Fatal("a model with a profile publishing events should be routed by them") } if ep, _ := m.EngineProfile("p"); !ep.KVEvents { t.Fatal("the engine has to be told to publish") } plain, _ := New([]Model{model("n")}) if n, _ := plain.Resolve("n"); n.KVIndex() { t.Fatal("off by default") } } func TestKVEventsAreVLLMsOnly(t *testing.T) { _, err := New([]Model{model("m", Profile{Name: "p", Engine: "llamacpp", KVEvents: true})}) if err == nil || !strings.Contains(err.Error(), "kv_events") { t.Fatalf("err %v", err) } } func TestTurningKVEventsOnMarksRunningReplicasStale(t *testing.T) { p := Profile{Name: "p", GPUClass: "h100-80g", TP: 1} q := p q.KVEvents = true if p.Fingerprint() == q.Fingerprint() { t.Fatal("replicas started without events do not publish until replaced, and should be shown as stale") } }