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

Function TestResolveEffectiveConfigInvalidQueryLogEnvValues

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

Source from the content-addressed store, hash-verified

299 t.Fatal("expected CLI --ducklake-delta-catalog-enabled to override env")
300 }
301 if got, want := resolved.Server.DuckLake.DeltaCatalogPath, "s3://warehouse/cli-delta/"; got != want {
302 t.Fatalf("expected CLI Delta catalog path %q, got %q", want, got)
303 }
304}
305
306func TestResolveEffectiveConfigInvalidQueryLogEnvValues(t *testing.T) {
307 env := map[string]string{
308 "DUCKGRES_QUERY_LOG_FLUSH_INTERVAL": "0s",
309 "DUCKGRES_QUERY_LOG_BATCH_SIZE": "-1",
310 }
311
312 var warns []string
313 resolved := configresolve.ResolveEffective(nil, configresolve.CLIInputs{}, envFromMap(env), func(msg string) {
314 warns = append(warns, msg)
315 })
316
317 if resolved.Server.QueryLog.FlushInterval != 5*time.Second {
318 t.Fatalf("expected default flush_interval 5s, got %s", resolved.Server.QueryLog.FlushInterval)
319 }
320 if resolved.Server.QueryLog.BatchSize != 1000 {
321 t.Fatalf("expected default batch_size 1000, got %d", resolved.Server.QueryLog.BatchSize)
322 }
323 wantWarnings := []string{
324 "DUCKGRES_QUERY_LOG_FLUSH_INTERVAL must be > 0",
325 "DUCKGRES_QUERY_LOG_BATCH_SIZE must be > 0",
326 }
327 for _, w := range wantWarnings {
328 found := false
329 for _, got := range warns {
330 if strings.Contains(got, w) {
331 found = true
332 break
333 }
334 }
335 if !found {
336 t.Fatalf("expected warning containing %q, warnings: %v", w, warns)
337 }
338 }
339}
340
341func TestResolveEffectiveConfigQueryLogCLIOverride(t *testing.T) {
342 fileCfg := &FileConfig{}
343

Callers

nothing calls this directly

Calls 2

ResolveEffectiveFunction · 0.92
envFromMapFunction · 0.85

Tested by

no test coverage detected