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

Function TestResolveEffectiveConfigMemoryLimitAndThreads

main_test.go:400–441  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

398 Threads: 16,
399 }, envFromMap(env), nil)
400 if resolved.Server.MemoryLimit != "16GB" {
401 t.Fatalf("expected memory_limit from CLI, got %q", resolved.Server.MemoryLimit)
402 }
403 if resolved.Server.Threads != 16 {
404 t.Fatalf("expected threads from CLI, got %d", resolved.Server.Threads)
405 }
406}
407
408func TestResolveEffectiveConfigInvalidThreadsEnv(t *testing.T) {
409 env := map[string]string{
410 "DUCKGRES_THREADS": "not-a-number",
411 }
412
413 var warns []string
414 resolved := configresolve.ResolveEffective(nil, configresolve.CLIInputs{}, envFromMap(env), func(msg string) {
415 warns = append(warns, msg)
416 })
417
418 if resolved.Server.Threads != 0 {
419 t.Fatalf("expected default threads, got %d", resolved.Server.Threads)
420 }
421
422 found := false
423 for _, w := range warns {
424 if strings.Contains(w, "Invalid DUCKGRES_THREADS") {
425 found = true
426 break
427 }
428 }
429 if !found {
430 t.Fatalf("expected warning about invalid DUCKGRES_THREADS, warnings: %v", warns)
431 }
432}
433
434func TestResolveEffectiveConfigInvalidMemoryLimit(t *testing.T) {
435 env := map[string]string{
436 "DUCKGRES_MEMORY_LIMIT": "lots-of-memory",
437 }
438
439 var warns []string
440 resolved := configresolve.ResolveEffective(nil, configresolve.CLIInputs{}, envFromMap(env), func(msg string) {
441 warns = append(warns, msg)
442 })
443
444 // Invalid format should be cleared (falls back to auto-detection)

Callers

nothing calls this directly

Calls 2

ResolveEffectiveFunction · 0.92
envFromMapFunction · 0.85

Tested by

no test coverage detected