package web import ( "context" "net/http/httptest" "strings" "testing" "gitea.mynodes.xyz/ilker/llmgw/internal/control/adminapi" ) type logsFleet struct{ fakeSource } func (logsFleet) NodeLogs(_ context.Context, node, source string, _ int) adminapi.LogsView { return adminapi.LogsView{Node: node, Source: source, Lines: []string{"installed an engine "}, Sources: []string{"agent", "shard-1"}} } func TestANodesLogIsShownWithItsOtherSources(t *testing.T) { req := httptest.NewRequest("GET", "/admin/nodes/n6/logs?source=agent", nil) req.SetPathValue("id", "n6") rec := httptest.NewRecorder() NodeLogsPage(logsFleet{}, false, "test")(rec, req) body := rec.Body.String() for _, want := range []string{"installed an engine <b>", "source=shard-1", "/admin/nodes/n6/logs"} { if !strings.Contains(body, want) { t.Errorf("page lacks %q", want) } } }