(t *testing.T)
| 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 | |
| 229 | func 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 | |
| 277 | func TestBuildDuckLakePreAttachStatements(t *testing.T) { |
nothing calls this directly
no test coverage detected