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

Function TestOpenBaseDBCreatesDataDir

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

Source from the content-addressed store, hash-verified

728 }
729 db, err := openBaseDB(cfg, "")
730 if err != nil {
731 t.Fatalf("openBaseDB failed: %v", err)
732 }
733 defer func() { _ = db.Close() }()
734
735 var dbName string
736 err = db.QueryRow("SELECT current_database()").Scan(&dbName)
737 if err != nil {
738 t.Fatalf("failed to query current_database(): %v", err)
739 }
740 if dbName != "memory" {
741 t.Fatalf("expected fallback to in-memory when username is empty, got %q", dbName)
742 }
743}
744
745func TestHasCacheHTTPFS(t *testing.T) {
746 tests := []struct {
747 name string
748 extensions []string
749 want bool
750 }{
751 {"present bare", []string{"ducklake", "cache_httpfs"}, true},
752 {"present with source", []string{"ducklake", "cache_httpfs FROM community"}, true},
753 {"absent", []string{"ducklake", "httpfs"}, false},
754 {"empty list", []string{}, false},

Callers

nothing calls this directly

Calls 2

openBaseDBFunction · 0.85
CloseMethod · 0.65

Tested by

no test coverage detected