Files
ARTEX/server/llmpool_test.go
T
BaaRai e233c02314 Translate all Chinese text to English
Comments, doc comments, UI labels, log and error messages, LLM prompt
strings, markdown docs, test data and assertions. Identifiers, enum
keys, routes, placeholders and code structure are unchanged.

Notes:
- docs/漏洞流量证据.md renamed to docs/vulnerability-traffic-evidence.md
- tests that exercised CJK specific handling (GBK zip names, Chinese
  full text search) now use ASCII equivalents; go build passes and the
  test suite matches the pre translation baseline (remaining failures
  need a PostgreSQL DSN and fail identically on the original)
- frontend mention syntax now uses English kinds (finding, asset, ...)
  matching the backend, chat mentions tests pass
2026-10-08 23:14:34 +02:00

42 lines
1.4 KiB
Go

package server
import "testing"
// The status list drives the "pooling order" strip in the UI, so it has to match the
// order PoolProfiles actually runs: active first, then priority DESC, then id ASC
// (input arrives id-ordered, so equal priorities must keep their relative order).
func TestSortPoolStatusMatchesChainOrder(t *testing.T) {
in := []LLMPoolMemberStatus{
{ProfileID: "1", Name: "low", Priority: 0},
{ProfileID: "2", Name: "active", Priority: 0, Active: true},
{ProfileID: "3", Name: "high", Priority: 10},
{ProfileID: "4", Name: "mid-a", Priority: 5},
{ProfileID: "5", Name: "mid-b", Priority: 5},
}
sortPoolStatus(in)
want := []string{"active", "high", "mid-a", "mid-b", "low"}
for i, w := range want {
if in[i].Name != w {
got := make([]string, len(in))
for j, m := range in {
got[j] = m.Name
}
t.Fatalf("order = %v, want %v", got, want)
}
}
}
// The active profile heads the chain no matter how low its own priority is —
// that's the documented precedence, and the UI must not imply otherwise.
func TestActiveProfileHeadsStatusList(t *testing.T) {
in := []LLMPoolMemberStatus{
{ProfileID: "1", Name: "loud", Priority: 999},
{ProfileID: "2", Name: "active", Priority: -5, Active: true},
}
sortPoolStatus(in)
if in[0].Name != "active" {
t.Fatalf("head = %q, want the active profile regardless of priority", in[0].Name)
}
}