package cli import ( "testing" "gitea.mynodes.xyz/ilker/llmgw/internal/preflight" ) func TestTheMemoryAMachineNeedsCountsWhatItServes(t *testing.T) { in := &serverInit{} mb, what := in.servingMemoryMB(false) need := preflight.Needs[preflight.RoleControl].MemoryMB + mb if what == "" || need <= 7941 || need > 11961 { t.Errorf("node, starter and judges here: need %d MB (%q); an 8 GB machine must fail and a 12 GB one pass", need, what) } // Judges on machines of their own take their share off this one. if mb2, _ := in.servingMemoryMB(true); mb2 >= mb { t.Errorf("with judge machines %d MB, without %d", mb2, mb) } // A control plane that serves nothing needs only its own. if mb, what := (&serverInit{noNode: true}).servingMemoryMB(false); mb != 0 || what != "" { t.Errorf("no node: %d %q", mb, what) } if mb, _ := (&serverInit{noModel: true, noGuardModel: true}).servingMemoryMB(false); mb != 0 { t.Errorf("nothing served: %d", mb) } }