package modelserve import ( "slices" "strings" "testing" "gitea.mynodes.xyz/ilker/llmgw/internal/hf" "gitea.mynodes.xyz/ilker/llmgw/internal/modelplan" ) func TestAStrataWayIsChosenAndMadeAProfile(t *testing.T) { set := hf.FileSet{Name: "Qwen3.8-Flash-Next-GSQ-RCO-IQ2_XS-00001-of-00002.gguf"} strataWay := modelplan.Option{Artifact: set.Name, Format: "gguf", Engine: "strata", Class: "6000-24g", GPUsPerNode: 1, Nodes: 1, NeedGB: 52, HaveGB: 213, Hosts: 1, StrataFamily: "qwen", StrataSize: "IQ2_XS"} cpuWay := modelplan.Option{Artifact: set.Name, Format: "gguf", Engine: "llamacpp", CPU: true, NeedGB: 75, HaveGB: 213, Hosts: 1} plan := Plan{Repo: "ISTA-DASLab/Qwen3.8-Flash-Next-GSQ-RCO-GGUF", Options: []modelplan.Option{strataWay, cpuWay}} got, err := chooseLayout(Request{Format: "gguf", Fallbacks: true}, plan, true, set) if err != nil || len(got) != 1 || got[0].Engine != "strata" { t.Fatalf("the plan's best, without llama.cpp fallbacks: %+v %v", got, err) } if got, _ := chooseLayout(Request{Format: "gguf", Engine: "llamacpp"}, plan, true, set); len(got) != 1 || !got[0].CPU { t.Errorf("kept off Strata: %+v", got) } if _, err := chooseLayout(Request{Format: "gguf", Engine: "strata", GPUClass: "h100-80g"}, plan, true, set); err == nil { t.Error("Strata on a class it was not planned for") } ps := profilesFor(got, Request{ContextLength: 32768}, 0, 0) p := ps[0] if p.Engine != "strata" || p.GPUClass != "6000-24g" || p.GPUsPerNode != 1 || p.MinMemoryGB != 52 || !slices.Equal(p.Args, []string{"--family", "qwen", "--size", "IQ2_XS", "--context", "32768", "--vision", "no"}) || !strings.HasPrefix(p.Name, "strata-") { t.Errorf("%+v", p) } } func TestAReadyMadePackIsPlannedOnStrataOnly(t *testing.T) { s := New(Deps{Pool: func() []modelplan.PoolNode { return []modelplan.PoolNode{{ID: "cuda01", Class: "6000-24g", GPUMemGB: 24, GPUs: 1, FreeGPUs: 1, HostMemGB: 251, HostFreeGB: 200, Engines: []string{"strata"}}} }}) p, err := s.plan(t.Context(), hf.Repo{ID: "Maximilian228/Qwen3.8-Flash-Next-NVIDIA-NVFP4-Strata", Revision: "abc", Architecture: "strata-ple"}, PlanRequest{}) if err != nil { t.Fatal(err) } if !p.Servable || len(p.Options) != 1 || p.Options[0].StrataFamily != "nvfp4" || p.Options[0].StrataSize != "NVFP4-NVIDIA" { t.Errorf("%+v", p) } }