Headers never wrap, free text is clipped with the whole on hover, full-width rows are only notes and forms. The cluster page hides columns empty on every row and shortens node names; People shows two memberships and a count. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
55 lines
2.2 KiB
Go
55 lines
2.2 KiB
Go
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{"<th>Classes</th>", "<th>Fabrics</th>", `<th class="num">GPUs</th>`, "<th>Fallbacks</th>"} {
|
|
if strings.Contains(body, gone) {
|
|
t.Errorf("%s is shown with nothing in it on any row", gone)
|
|
}
|
|
}
|
|
if !strings.Contains(body, `title="llmgw-node01"><code>node01</code>`) {
|
|
t.Error("node names should drop what every node shares, keeping the whole on hover")
|
|
}
|
|
if !strings.Contains(body, `<code title="llmgw-node02">node02</code>`) {
|
|
t.Error("the replicas table should name nodes the same way")
|
|
}
|
|
if strings.Contains(body, `class="url-row"`) || !strings.Contains(body, `<td class="clip" title="A sentence long enough`) {
|
|
t.Error("a model's description should be a clipped cell, not a row of its own")
|
|
}
|
|
|
|
// A cluster with GPUs still gets its GPU column.
|
|
_, gpu := get(t, Dashboard(fakeSource{}, nil, "v1", time.Second, true, NavExtras{}, nil), "http://127.0.0.1:9090/", nil)
|
|
if !strings.Contains(gpu, `<th class="num">GPUs</th>`) || !strings.Contains(gpu, "<th>Fabrics</th>") {
|
|
t.Error("columns with something in them were hidden")
|
|
}
|
|
}
|