package web import ( "strings" "testing" "time" "gitea.mynodes.xyz/ilker/llmgw/internal/control/adminapi" ) // cpuFleet is a CPU-only cluster whose nodes share a name prefix. type cpuFleet struct{ fakeSource } func (cpuFleet) Nodes() []adminapi.NodeView { return []adminapi.NodeView{ {ID: "llmgw-node01", State: "ready", MgmtAddr: "10.0.0.141", MemoryGB: 8}, {ID: "llmgw-node02", State: "ready", MgmtAddr: "10.0.0.142", MemoryGB: 8}, } } func (cpuFleet) Summary() adminapi.Summary { return adminapi.Summary{} } func (cpuFleet) Models() []adminapi.ModelView { return []adminapi.ModelView{{Name: "qwen", Min: 1, Max: 1, Ready: 1, Description: "A sentence long enough that it once had a row of its own under the model."}} } func (cpuFleet) Replicas(string) []adminapi.ReplicaView { return []adminapi.ReplicaView{{ID: "qwen-1", Model: "qwen", State: "ready", Shards: []adminapi.ShardView{{Node: "llmgw-node02"}}}} } func TestTheClusterPageKeepsEachRecordOnOneLine(t *testing.T) { h := Dashboard(cpuFleet{}, nil, "v1", time.Second, true, NavExtras{}, nil) _, body := get(t, h, "http://127.0.0.1:9090/", nil) for _, gone := range []string{"
node01`) {
t.Error("node names should drop what every node shares, keeping the whole on hover")
}
if !strings.Contains(body, `node02`) {
t.Error("the replicas table should name nodes the same way")
}
if strings.Contains(body, `class="url-row"`) || !strings.Contains(body, `