Files
llmgw/internal/config/engines_test.go
T
Ilker ManapandClaude Opus 5.5 09ebe77513
CI / test (push) Failing after 9m58s
A GGUF is servable when a llama.cpp that engine_overrides give some nodes loads it
`ctl model serve`, its plan and model updates judged a file only against
the cluster's own llama.cpp, so a GPU node given a newer build could not
be served an architecture only that build knows: Inkling 2 Mini
(inkling2_loop) was refused for b10991 with cuda01 on b12606.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-21 13:43:40 +01:00

72 lines
2.6 KiB
Go

package config
import (
"slices"
"strings"
"testing"
)
func TestEachNodeGetsTheEnginesItsOverridesSay(t *testing.T) {
s := Server{
Engines: map[string]string{"vllm": "0.30.0"},
EngineOverrides: []EngineOverride{
// Volta: CUDA 13 dropped it, CUDA 12 vLLM still runs.
{GPUClass: "v100-32g", Engines: map[string]string{"vllm": "0.25.1"}},
// Nodes meant for llama.cpp alone.
{Labels: map[string]string{"role": "gguf"}, Engines: map[string]string{"vllm": ""}},
},
}
if got := s.EnginesFor("h1", []string{"h100-80g"}, nil); got["vllm"] != "0.30.0" || got["llamacpp"] == "" {
t.Errorf("an H100 node: %v", got)
}
if got := s.EnginesFor("v1", []string{"v100-32g"}, nil); got["vllm"] != "0.25.1" {
t.Errorf("a V100 node: %v", got)
}
got := s.EnginesFor("v2", []string{"v100-32g"}, map[string]string{"role": "gguf"})
if _, has := got["vllm"]; has || got["llamacpp"] == "" {
t.Errorf("a V100 node for llama.cpp alone, the later override last: %v", got)
}
for _, bad := range []EngineOverride{
{Engines: map[string]string{"vllm": ""}},
{GPUClass: "v100-32g"},
} {
s := Server{Listen: ":8080", EngineOverrides: []EngineOverride{bad}}
if err := s.Validate(); err == nil || !strings.Contains(err.Error(), "engine_overrides[0]") {
t.Errorf("%+v: %v", bad, err)
}
}
}
func TestOIDCSettingsAreCheckedBeforeAProviderIsAsked(t *testing.T) {
ok := OIDC{Issuer: "https://login.example.com/realms/acme", ClientID: "llmgw",
Roles: map[string][]string{"admin": {"g"}}, Memberships: map[string]string{"ml": "team:Acme/ml"}}
if err := ok.Validate(); err != nil {
t.Fatal(err)
}
for name, o := range map[string]OIDC{
"plain http": {Issuer: "http://login.example.com", ClientID: "x"},
"no client": {Issuer: "https://login.example.com"},
"unknown role": {Issuer: "https://l", ClientID: "x", Roles: map[string][]string{"god": {"g"}}},
"bad place": {Issuer: "https://l", ClientID: "x", Memberships: map[string]string{"g": "galaxy:x"}},
} {
if o.Validate() == nil {
t.Errorf("%s accepted", name)
}
}
}
func TestOverrideVersionsAreTheEnginesNodesAreGivenInstead(t *testing.T) {
s := Server{EngineOverrides: []EngineOverride{
{Nodes: []string{"cuda01"}, Engines: map[string]string{"strata": "0.2.7", "llamacpp": "b12606"}},
{GPUClass: "v100-32g", Engines: map[string]string{"llamacpp": ""}},
{Labels: map[string]string{"site": "b"}, Engines: map[string]string{"llamacpp": "b12606"}},
}}
if got := s.OverrideVersions("llamacpp"); !slices.Equal(got, []string{"b12606"}) {
t.Errorf("llamacpp: %v", got)
}
if got := s.OverrideVersions("vllm"); got != nil {
t.Errorf("vllm: %v", got)
}
}