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

Function TestBuildDuckLakePreAttachStatements

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

Source from the content-addressed store, hash-verified

218 TLSCertFile: certFile,
219 TLSKeyFile: keyFile,
220 })
221 if err == nil {
222 t.Fatal("expected bootstrap failure")
223 }
224 if !strings.Contains(err.Error(), "bootstrap bundled DuckDB extensions") {
225 t.Fatalf("expected bootstrap error, got %v", err)
226 }
227}
228
229func TestNeedsCredentialRefresh(t *testing.T) {
230 tests := []struct {
231 name string
232 cfg DuckLakeConfig
233 want bool
234 }{
235 {
236 "credential_chain with object store",
237 DuckLakeConfig{ObjectStore: "s3://bucket/path/", S3Provider: "credential_chain"},
238 true,
239 },
240 {
241 "implicit credential_chain (no access key, no provider)",
242 DuckLakeConfig{ObjectStore: "s3://bucket/path/"},
243 true,
244 },
245 {
246 "config provider with explicit credentials",
247 DuckLakeConfig{ObjectStore: "s3://bucket/path/", S3Provider: "config", S3AccessKey: "key", S3SecretKey: "secret"},
248 false,
249 },
250 {
251 "implicit config provider (access key set)",
252 DuckLakeConfig{ObjectStore: "s3://bucket/path/", S3AccessKey: "key", S3SecretKey: "secret"},
253 false,
254 },
255 {
256 "no object store",
257 DuckLakeConfig{MetadataStore: "postgres:..."},
258 false,
259 },
260 {
261 "empty config",
262 DuckLakeConfig{},
263 false,
264 },
265 }
266
267 for _, tt := range tests {
268 t.Run(tt.name, func(t *testing.T) {
269 got := needsCredentialRefresh(tt.cfg)
270 if got != tt.want {
271 t.Errorf("needsCredentialRefresh() = %v, want %v", got, tt.want)
272 }
273 })
274 }
275}
276
277func TestBuildDuckLakePreAttachStatements(t *testing.T) {

Callers

nothing calls this directly

Calls 3

boolPtrFunction · 0.70
RunMethod · 0.65

Tested by

no test coverage detected