MCPcopy Create free account
hub / github.com/PostHog/duckgres / TestNewMemoryRebalancerDefaults

Function TestNewMemoryRebalancerDefaults

controlplane/memory_rebalancer_test.go:69–79  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

67 }
68}
69
70func TestNewMemoryRebalancerDefaults(t *testing.T) {
71 // With 0 budget, should auto-detect (or fallback)
72 r := NewMemoryRebalancer(0, 0, &mockSessionLister{}, true)
73 t.Cleanup(r.Stop)
74 if r.memoryBudget == 0 {
75 t.Error("expected non-zero memory budget")
76 }
77 if r.threadBudget == 0 {
78 t.Error("expected non-zero thread budget")
79 }
80 wantThreads := (runtime.NumCPU()*5 + 1) / 2
81 if r.threadBudget != wantThreads {
82 t.Errorf("thread budget = %d, want ceil(2.5 * %d CPUs) = %d", r.threadBudget, runtime.NumCPU(), wantThreads)

Callers

nothing calls this directly

Calls 2

NewMemoryRebalancerFunction · 0.85
ErrorMethod · 0.45

Tested by

no test coverage detected