(t *testing.T)
| 412 | t.Fatalf("expected two exec attempts, got %d", calls) |
| 413 | } |
| 414 | } |
| 415 | |
| 416 | func 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 | |
| 429 | func 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 | } |
nothing calls this directly
no test coverage detected