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

Function TestStartCredentialRefresh_StopsCleanly

server/server_test.go:414–443  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

412 t.Fatalf("expected two exec attempts, got %d", calls)
413 }
414}
415
416func TestConfigureDuckLakeMetadataPoolRunsExpectedStatement(t *testing.T) {
417 execer := &mockDuckLakeExecer{}
418 configureDuckLakeMetadataPool(execer)
419
420 calls, queries := execer.calls()
421 if calls != 1 {
422 t.Fatalf("expected one pool-config exec, got %d", calls)
423 }
424 if len(queries) != 1 || !strings.Contains(queries[0], "postgres_configure_pool") {
425 t.Fatalf("expected postgres_configure_pool statement, got %v", queries)
426 }
427}
428
429func TestDuckLakeMetadataIndexesNamesMatchStatements(t *testing.T) {
430 if len(duckLakeMetadataIndexes) == 0 {
431 t.Fatalf("duckLakeMetadataIndexes must not be empty")
432 }
433 seen := make(map[string]struct{}, len(duckLakeMetadataIndexes))
434 for _, ix := range duckLakeMetadataIndexes {
435 if ix.name == "" {
436 t.Errorf("index has empty name: %+v", ix)
437 }
438 if !strings.Contains(ix.stmt, ix.name) {
439 t.Errorf("index %q statement does not reference its own name: %q", ix.name, ix.stmt)
440 }
441 if !strings.HasPrefix(ix.stmt, "CREATE INDEX IF NOT EXISTS ") {
442 t.Errorf("index %q statement must use CREATE INDEX IF NOT EXISTS: %q", ix.name, ix.stmt)
443 }
444 if _, dup := seen[ix.name]; dup {
445 t.Errorf("duplicate index name %q", ix.name)
446 }

Callers

nothing calls this directly

Calls 4

StartCredentialRefreshFunction · 0.85
CloseMethod · 0.65
ExecMethod · 0.65
OpenMethod · 0.45

Tested by

no test coverage detected