Honeycomb und Control-Patch
This commit is contained in:
@@ -116,3 +116,46 @@ func TestRequestEnrichDoesNotQueueDuplicateCycle(t *testing.T) {
|
||||
t.Fatalf("unexpected enrich status: %#v", status["enrich_result"])
|
||||
}
|
||||
}
|
||||
|
||||
func TestRuntimeSettingsDisableThinkingAndPersist(t *testing.T) {
|
||||
data := t.TempDir()
|
||||
g, err := graph.Open(data)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
cfg := config.Config{DataDir: data, RuntimeDefaultsConfigured: true, LearningEnabled: true, ThinkingEnabled: true, DefaultView: "neural", PersistInterval: time.Minute}
|
||||
e := New(cfg, g, activity.New(20))
|
||||
updated, err := e.SetRuntimeSettings(RuntimeSettings{
|
||||
LearningEnabled: false,
|
||||
ThinkingEnabled: false,
|
||||
LearningCategories: []string{"Netzwerk"},
|
||||
DisplayCategories: []string{"GLPI KB"},
|
||||
ThinkingCategories: []string{"Netzwerk"},
|
||||
ViewMode: "honeycomb",
|
||||
})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if updated.LearningEnabled || updated.ThinkingEnabled || updated.ViewMode != "honeycomb" {
|
||||
t.Fatalf("unexpected runtime settings: %+v", updated)
|
||||
}
|
||||
if e.RequestEnrich("manual") {
|
||||
t.Fatal("disabled thinking must not queue AI-THINK")
|
||||
}
|
||||
if err := e.Scan(context.Background()); err != ErrLearningDisabled {
|
||||
t.Fatalf("expected ErrLearningDisabled, got %v", err)
|
||||
}
|
||||
if err := e.Flush(context.Background()); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
g2, err := graph.Open(data)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
e2 := New(cfg, g2, activity.New(20))
|
||||
loaded := e2.RuntimeSettings()
|
||||
if loaded.LearningEnabled || loaded.ThinkingEnabled || loaded.ViewMode != "honeycomb" || len(loaded.DisplayCategories) != 1 {
|
||||
t.Fatalf("runtime settings were not restored: %+v", loaded)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user