@malloy-publisher/server 0.0.167 → 0.0.168
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc.json +9 -1
- package/dist/app/api-doc.yaml +36 -1
- package/dist/app/assets/HomePage-D2tUw_9U.js +1 -0
- package/dist/app/assets/{MainPage-C9Fr5IN8.js → MainPage-DBQW76L7.js} +2 -2
- package/dist/app/assets/{ModelPage-BkU6HAHA.js → ModelPage-BnfOKuhQ.js} +1 -1
- package/dist/app/assets/PackagePage-zPhE-rDg.js +1 -0
- package/dist/app/assets/ProjectPage-BpSTvuW6.js +1 -0
- package/dist/app/assets/RouteError-Cp9-yCK5.js +1 -0
- package/dist/app/assets/{WorkbookPage-D3rUQZj6.js → WorkbookPage-FD_gmxeE.js} +1 -1
- package/dist/app/assets/{index-BLxl0XLH.js → index-D5QBYuLK.js} +150 -150
- package/dist/app/assets/{index-lhDwptrQ.js → index-DNCvL_5f.js} +1 -1
- package/dist/app/assets/{index-hkABoiMV.js → index-x9S1fsYn.js} +1 -1
- package/dist/app/assets/{index.umd-BkXQ-YAe.js → index.umd-CTYdFEHH.js} +1 -1
- package/dist/app/index.html +1 -1
- package/dist/server.js +261 -27
- package/package.json +1 -1
- package/src/controller/connection.controller.ts +22 -2
- package/src/server.ts +5 -1
- package/src/service/connection.spec.ts +105 -0
- package/src/service/connection.ts +293 -17
- package/src/service/db_utils.ts +85 -4
- package/src/service/project.ts +20 -3
- package/tests/harness/mcp_test_setup.ts +166 -26
- package/tests/unit/duckdb/attached_databases.test.ts +61 -3
- package/tests/unit/ducklake/ducklake.test.ts +950 -0
- package/dist/app/assets/HomePage-D76UaGFV.js +0 -1
- package/dist/app/assets/PackagePage-BhE9Wi7b.js +0 -1
- package/dist/app/assets/ProjectPage-BatZLVap.js +0 -1
- package/dist/app/assets/RouteError-Bo5zJ8Xa.js +0 -1
|
@@ -0,0 +1,950 @@
|
|
|
1
|
+
import { DuckDBConnection } from "@malloydata/db-duckdb";
|
|
2
|
+
import { afterEach, beforeEach, describe, expect, it } from "bun:test";
|
|
3
|
+
import fs from "fs/promises";
|
|
4
|
+
import path from "path";
|
|
5
|
+
import { components } from "../../../src/api";
|
|
6
|
+
import {
|
|
7
|
+
createProjectConnections,
|
|
8
|
+
deleteDuckLakeConnectionFile,
|
|
9
|
+
testConnectionConfig,
|
|
10
|
+
} from "../../../src/service/connection";
|
|
11
|
+
import {
|
|
12
|
+
getSchemasForConnection,
|
|
13
|
+
getTablesForSchema,
|
|
14
|
+
} from "../../../src/service/db_utils";
|
|
15
|
+
|
|
16
|
+
type ApiConnection = components["schemas"]["Connection"];
|
|
17
|
+
|
|
18
|
+
const hasPostgresCredentials = () =>
|
|
19
|
+
!!(
|
|
20
|
+
process.env.POSTGRES_TEST_HOST &&
|
|
21
|
+
process.env.POSTGRES_TEST_USER &&
|
|
22
|
+
process.env.POSTGRES_TEST_PASSWORD
|
|
23
|
+
);
|
|
24
|
+
|
|
25
|
+
const hasS3Credentials = () =>
|
|
26
|
+
!!(
|
|
27
|
+
process.env.S3_TEST_ACCESS_KEY_ID && process.env.S3_TEST_SECRET_ACCESS_KEY
|
|
28
|
+
);
|
|
29
|
+
|
|
30
|
+
const hasGCSCredentials = () =>
|
|
31
|
+
!!(process.env.GCS_TEST_KEY_ID && process.env.GCS_TEST_SECRET);
|
|
32
|
+
|
|
33
|
+
describe("DuckLake Connection Tests", () => {
|
|
34
|
+
const testProjectPath = path.join(process.cwd(), "test-project-ducklake");
|
|
35
|
+
let createdConnections: DuckDBConnection[] = [];
|
|
36
|
+
|
|
37
|
+
beforeEach(async () => {
|
|
38
|
+
await fs.mkdir(testProjectPath, { recursive: true });
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
afterEach(async () => {
|
|
42
|
+
// Close all connections
|
|
43
|
+
for (const conn of createdConnections) {
|
|
44
|
+
try {
|
|
45
|
+
await conn.close();
|
|
46
|
+
} catch (error) {
|
|
47
|
+
console.warn("Error closing connection:", error);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
createdConnections = [];
|
|
51
|
+
|
|
52
|
+
// Clean up DuckLake database files from testProjectPath
|
|
53
|
+
try {
|
|
54
|
+
const files = await fs.readdir(testProjectPath);
|
|
55
|
+
for (const file of files) {
|
|
56
|
+
if (file.endsWith("_ducklake.duckdb")) {
|
|
57
|
+
await fs.rm(path.join(testProjectPath, file), { force: true });
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
} catch (error) {
|
|
61
|
+
// Ignore cleanup errors
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
// Clean up DuckLake database files from process.cwd() (created by testConnectionConfig)
|
|
65
|
+
// testConnectionConfig creates files in process.cwd() instead of testProjectPath
|
|
66
|
+
try {
|
|
67
|
+
const cwdFiles = await fs.readdir(process.cwd());
|
|
68
|
+
for (const file of cwdFiles) {
|
|
69
|
+
if (file.endsWith("_ducklake.duckdb")) {
|
|
70
|
+
const filePath = path.join(process.cwd(), file);
|
|
71
|
+
// Only delete test files, not production files
|
|
72
|
+
if (file.includes("_test") || file.includes("invalid")) {
|
|
73
|
+
await fs.rm(filePath, { force: true });
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
} catch (_error) {
|
|
78
|
+
// Ignore cleanup errors (file might not exist or already deleted)
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
// Clean up test directory
|
|
82
|
+
const maxRetries = 5;
|
|
83
|
+
const delay = 100;
|
|
84
|
+
let lastError: unknown;
|
|
85
|
+
|
|
86
|
+
for (let attempt = 0; attempt < maxRetries; attempt++) {
|
|
87
|
+
try {
|
|
88
|
+
await fs.rm(testProjectPath, { recursive: true, force: true });
|
|
89
|
+
return;
|
|
90
|
+
} catch (error) {
|
|
91
|
+
lastError = error;
|
|
92
|
+
const errnoError = error as NodeJS.ErrnoException;
|
|
93
|
+
if (errnoError.code !== "EBUSY") throw error;
|
|
94
|
+
if (attempt < maxRetries - 1) {
|
|
95
|
+
await new Promise((resolve) =>
|
|
96
|
+
setTimeout(resolve, delay * Math.pow(2, attempt)),
|
|
97
|
+
);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
if ((lastError as NodeJS.ErrnoError).code !== "EBUSY") {
|
|
103
|
+
throw lastError;
|
|
104
|
+
}
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
describe("Connection Creation", () => {
|
|
108
|
+
it(
|
|
109
|
+
"should create DuckLake connection with S3 storage",
|
|
110
|
+
async () => {
|
|
111
|
+
if (!hasPostgresCredentials() || !hasS3Credentials()) {
|
|
112
|
+
console.log(
|
|
113
|
+
"Skipping: PostgreSQL and S3 credentials not configured",
|
|
114
|
+
);
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
const ducklakeConnection: ApiConnection = {
|
|
119
|
+
name: "ducklake_s3_test",
|
|
120
|
+
type: "ducklake",
|
|
121
|
+
ducklakeConnection: {
|
|
122
|
+
catalog: {
|
|
123
|
+
postgresConnection: {
|
|
124
|
+
host: process.env.POSTGRES_TEST_HOST,
|
|
125
|
+
port: parseInt(
|
|
126
|
+
process.env.POSTGRES_TEST_PORT || "5432",
|
|
127
|
+
),
|
|
128
|
+
userName: process.env.POSTGRES_TEST_USER!,
|
|
129
|
+
password: process.env.POSTGRES_TEST_PASSWORD!,
|
|
130
|
+
databaseName: process.env.POSTGRES_TEST_DATABASE,
|
|
131
|
+
},
|
|
132
|
+
},
|
|
133
|
+
storage: {
|
|
134
|
+
bucketUrl:
|
|
135
|
+
process.env.S3_TEST_BUCKET_URL || "s3://test-bucket",
|
|
136
|
+
s3Connection: {
|
|
137
|
+
accessKeyId: process.env.S3_TEST_ACCESS_KEY_ID!,
|
|
138
|
+
secretAccessKey: process.env.S3_TEST_SECRET_ACCESS_KEY!,
|
|
139
|
+
region: process.env.S3_TEST_REGION || "us-east-1",
|
|
140
|
+
},
|
|
141
|
+
},
|
|
142
|
+
},
|
|
143
|
+
};
|
|
144
|
+
|
|
145
|
+
const { malloyConnections, apiConnections } =
|
|
146
|
+
await createProjectConnections(
|
|
147
|
+
[ducklakeConnection],
|
|
148
|
+
testProjectPath,
|
|
149
|
+
);
|
|
150
|
+
|
|
151
|
+
expect(malloyConnections.size).toBe(1);
|
|
152
|
+
expect(apiConnections.length).toBe(1);
|
|
153
|
+
|
|
154
|
+
const connection = malloyConnections.get(
|
|
155
|
+
"ducklake_s3_test",
|
|
156
|
+
) as DuckDBConnection;
|
|
157
|
+
expect(connection).toBeDefined();
|
|
158
|
+
createdConnections.push(connection);
|
|
159
|
+
|
|
160
|
+
// Verify DuckLake database is attached
|
|
161
|
+
const databases = await connection.runSQL("SHOW DATABASES");
|
|
162
|
+
const dbNames = databases.rows.map((row) => Object.values(row)[0]);
|
|
163
|
+
expect(dbNames).toContain("ducklake_s3_test");
|
|
164
|
+
|
|
165
|
+
// Verify database file was created
|
|
166
|
+
const dbPath = path.join(
|
|
167
|
+
testProjectPath,
|
|
168
|
+
"ducklake_s3_test_ducklake.duckdb",
|
|
169
|
+
);
|
|
170
|
+
const exists = await fs
|
|
171
|
+
.access(dbPath)
|
|
172
|
+
.then(() => true)
|
|
173
|
+
.catch(() => false);
|
|
174
|
+
expect(exists).toBe(true);
|
|
175
|
+
},
|
|
176
|
+
{ timeout: 30000 },
|
|
177
|
+
);
|
|
178
|
+
|
|
179
|
+
it(
|
|
180
|
+
"should create DuckLake connection with GCS storage",
|
|
181
|
+
async () => {
|
|
182
|
+
if (!hasPostgresCredentials() || !hasGCSCredentials()) {
|
|
183
|
+
console.log(
|
|
184
|
+
"Skipping: PostgreSQL and GCS credentials not configured",
|
|
185
|
+
);
|
|
186
|
+
return;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
const ducklakeConnection: ApiConnection = {
|
|
190
|
+
name: "ducklake_gcs_test",
|
|
191
|
+
type: "ducklake",
|
|
192
|
+
ducklakeConnection: {
|
|
193
|
+
catalog: {
|
|
194
|
+
postgresConnection: {
|
|
195
|
+
host: process.env.POSTGRES_TEST_HOST,
|
|
196
|
+
port: parseInt(
|
|
197
|
+
process.env.POSTGRES_TEST_PORT || "5432",
|
|
198
|
+
),
|
|
199
|
+
userName: process.env.POSTGRES_TEST_USER!,
|
|
200
|
+
password: process.env.POSTGRES_TEST_PASSWORD!,
|
|
201
|
+
databaseName: process.env.POSTGRES_TEST_DATABASE,
|
|
202
|
+
},
|
|
203
|
+
},
|
|
204
|
+
storage: {
|
|
205
|
+
bucketUrl:
|
|
206
|
+
process.env.GCS_TEST_BUCKET_URL || "gs://test-bucket",
|
|
207
|
+
gcsConnection: {
|
|
208
|
+
keyId: process.env.GCS_TEST_KEY_ID!,
|
|
209
|
+
secret: process.env.GCS_TEST_SECRET!,
|
|
210
|
+
},
|
|
211
|
+
},
|
|
212
|
+
},
|
|
213
|
+
};
|
|
214
|
+
|
|
215
|
+
const { malloyConnections } = await createProjectConnections(
|
|
216
|
+
[ducklakeConnection],
|
|
217
|
+
testProjectPath,
|
|
218
|
+
);
|
|
219
|
+
|
|
220
|
+
const connection = malloyConnections.get(
|
|
221
|
+
"ducklake_gcs_test",
|
|
222
|
+
) as DuckDBConnection;
|
|
223
|
+
expect(connection).toBeDefined();
|
|
224
|
+
createdConnections.push(connection);
|
|
225
|
+
|
|
226
|
+
// Verify DuckLake database is attached
|
|
227
|
+
const databases = await connection.runSQL("SHOW DATABASES");
|
|
228
|
+
const dbNames = databases.rows.map((row) => Object.values(row)[0]);
|
|
229
|
+
expect(dbNames).toContain("ducklake_gcs_test");
|
|
230
|
+
},
|
|
231
|
+
{ timeout: 30000 },
|
|
232
|
+
);
|
|
233
|
+
|
|
234
|
+
it(
|
|
235
|
+
"should load required extensions for DuckLake",
|
|
236
|
+
async () => {
|
|
237
|
+
if (!hasPostgresCredentials() || !hasS3Credentials()) {
|
|
238
|
+
console.log(
|
|
239
|
+
"Skipping: PostgreSQL and S3 credentials not configured",
|
|
240
|
+
);
|
|
241
|
+
return;
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
const ducklakeConnection: ApiConnection = {
|
|
245
|
+
name: "ducklake_extensions_test",
|
|
246
|
+
type: "ducklake",
|
|
247
|
+
ducklakeConnection: {
|
|
248
|
+
catalog: {
|
|
249
|
+
postgresConnection: {
|
|
250
|
+
host: process.env.POSTGRES_TEST_HOST,
|
|
251
|
+
port: parseInt(
|
|
252
|
+
process.env.POSTGRES_TEST_PORT || "5432",
|
|
253
|
+
),
|
|
254
|
+
userName: process.env.POSTGRES_TEST_USER!,
|
|
255
|
+
password: process.env.POSTGRES_TEST_PASSWORD!,
|
|
256
|
+
databaseName: process.env.POSTGRES_TEST_DATABASE,
|
|
257
|
+
},
|
|
258
|
+
},
|
|
259
|
+
storage: {
|
|
260
|
+
bucketUrl:
|
|
261
|
+
process.env.S3_TEST_BUCKET_URL || "s3://test-bucket",
|
|
262
|
+
s3Connection: {
|
|
263
|
+
accessKeyId: process.env.S3_TEST_ACCESS_KEY_ID!,
|
|
264
|
+
secretAccessKey: process.env.S3_TEST_SECRET_ACCESS_KEY!,
|
|
265
|
+
region: process.env.S3_TEST_REGION || "us-east-1",
|
|
266
|
+
},
|
|
267
|
+
},
|
|
268
|
+
},
|
|
269
|
+
};
|
|
270
|
+
|
|
271
|
+
const { malloyConnections } = await createProjectConnections(
|
|
272
|
+
[ducklakeConnection],
|
|
273
|
+
testProjectPath,
|
|
274
|
+
);
|
|
275
|
+
|
|
276
|
+
const connection = malloyConnections.get(
|
|
277
|
+
"ducklake_extensions_test",
|
|
278
|
+
) as DuckDBConnection;
|
|
279
|
+
createdConnections.push(connection);
|
|
280
|
+
|
|
281
|
+
// Verify required extensions are loaded
|
|
282
|
+
const extensions = await connection.runSQL(
|
|
283
|
+
"SELECT extension_name FROM duckdb_extensions() WHERE loaded = true",
|
|
284
|
+
);
|
|
285
|
+
const extensionNames = extensions.rows.map(
|
|
286
|
+
(row) => Object.values(row)[0] as string,
|
|
287
|
+
);
|
|
288
|
+
|
|
289
|
+
// DuckLake requires these extensions
|
|
290
|
+
expect(extensionNames).toContain("ducklake");
|
|
291
|
+
expect(extensionNames).toContain("postgres_scanner");
|
|
292
|
+
expect(extensionNames).toContain("httpfs");
|
|
293
|
+
},
|
|
294
|
+
{ timeout: 30000 },
|
|
295
|
+
);
|
|
296
|
+
});
|
|
297
|
+
|
|
298
|
+
describe("Schema Operations", () => {
|
|
299
|
+
it(
|
|
300
|
+
"should list schemas from DuckLake connection",
|
|
301
|
+
async () => {
|
|
302
|
+
if (!hasPostgresCredentials() || !hasS3Credentials()) {
|
|
303
|
+
console.log(
|
|
304
|
+
"Skipping: PostgreSQL and S3 credentials not configured",
|
|
305
|
+
);
|
|
306
|
+
return;
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
const ducklakeConnection: ApiConnection = {
|
|
310
|
+
name: "ducklake_schemas_test",
|
|
311
|
+
type: "ducklake",
|
|
312
|
+
ducklakeConnection: {
|
|
313
|
+
catalog: {
|
|
314
|
+
postgresConnection: {
|
|
315
|
+
host: process.env.POSTGRES_TEST_HOST,
|
|
316
|
+
port: parseInt(
|
|
317
|
+
process.env.POSTGRES_TEST_PORT || "5432",
|
|
318
|
+
),
|
|
319
|
+
userName: process.env.POSTGRES_TEST_USER!,
|
|
320
|
+
password: process.env.POSTGRES_TEST_PASSWORD!,
|
|
321
|
+
databaseName: process.env.POSTGRES_TEST_DATABASE,
|
|
322
|
+
},
|
|
323
|
+
},
|
|
324
|
+
storage: {
|
|
325
|
+
bucketUrl:
|
|
326
|
+
process.env.S3_TEST_BUCKET_URL || "s3://test-bucket",
|
|
327
|
+
s3Connection: {
|
|
328
|
+
accessKeyId: process.env.S3_TEST_ACCESS_KEY_ID!,
|
|
329
|
+
secretAccessKey: process.env.S3_TEST_SECRET_ACCESS_KEY!,
|
|
330
|
+
region: process.env.S3_TEST_REGION || "us-east-1",
|
|
331
|
+
},
|
|
332
|
+
},
|
|
333
|
+
},
|
|
334
|
+
};
|
|
335
|
+
|
|
336
|
+
const { malloyConnections } = await createProjectConnections(
|
|
337
|
+
[ducklakeConnection],
|
|
338
|
+
testProjectPath,
|
|
339
|
+
);
|
|
340
|
+
|
|
341
|
+
const connection = malloyConnections.get(
|
|
342
|
+
"ducklake_schemas_test",
|
|
343
|
+
) as DuckDBConnection;
|
|
344
|
+
createdConnections.push(connection);
|
|
345
|
+
|
|
346
|
+
// Test schema listing using db_utils
|
|
347
|
+
const schemas = await getSchemasForConnection(
|
|
348
|
+
ducklakeConnection,
|
|
349
|
+
connection,
|
|
350
|
+
);
|
|
351
|
+
expect(schemas).toBeDefined();
|
|
352
|
+
expect(Array.isArray(schemas)).toBe(true);
|
|
353
|
+
|
|
354
|
+
// Also test direct SQL query
|
|
355
|
+
const result = await connection.runSQL(
|
|
356
|
+
`SELECT DISTINCT schema_name FROM information_schema.schemata WHERE catalog_name = 'ducklake_schemas_test' ORDER BY schema_name`,
|
|
357
|
+
);
|
|
358
|
+
expect(result.rows).toBeDefined();
|
|
359
|
+
expect(result.rows.length).toBeGreaterThanOrEqual(0);
|
|
360
|
+
},
|
|
361
|
+
{ timeout: 30000 },
|
|
362
|
+
);
|
|
363
|
+
});
|
|
364
|
+
|
|
365
|
+
describe("Table Operations", () => {
|
|
366
|
+
it(
|
|
367
|
+
"should list tables from DuckLake schema",
|
|
368
|
+
async () => {
|
|
369
|
+
if (!hasPostgresCredentials() || !hasS3Credentials()) {
|
|
370
|
+
console.log(
|
|
371
|
+
"Skipping: PostgreSQL and S3 credentials not configured",
|
|
372
|
+
);
|
|
373
|
+
return;
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
const ducklakeConnection: ApiConnection = {
|
|
377
|
+
name: "ducklake_tables_test",
|
|
378
|
+
type: "ducklake",
|
|
379
|
+
ducklakeConnection: {
|
|
380
|
+
catalog: {
|
|
381
|
+
postgresConnection: {
|
|
382
|
+
host: process.env.POSTGRES_TEST_HOST,
|
|
383
|
+
port: parseInt(
|
|
384
|
+
process.env.POSTGRES_TEST_PORT || "5432",
|
|
385
|
+
),
|
|
386
|
+
userName: process.env.POSTGRES_TEST_USER!,
|
|
387
|
+
password: process.env.POSTGRES_TEST_PASSWORD!,
|
|
388
|
+
databaseName: process.env.POSTGRES_TEST_DATABASE,
|
|
389
|
+
},
|
|
390
|
+
},
|
|
391
|
+
storage: {
|
|
392
|
+
bucketUrl:
|
|
393
|
+
process.env.S3_TEST_BUCKET_URL || "s3://test-bucket",
|
|
394
|
+
s3Connection: {
|
|
395
|
+
accessKeyId: process.env.S3_TEST_ACCESS_KEY_ID!,
|
|
396
|
+
secretAccessKey: process.env.S3_TEST_SECRET_ACCESS_KEY!,
|
|
397
|
+
region: process.env.S3_TEST_REGION || "us-east-1",
|
|
398
|
+
},
|
|
399
|
+
},
|
|
400
|
+
},
|
|
401
|
+
};
|
|
402
|
+
|
|
403
|
+
const { malloyConnections } = await createProjectConnections(
|
|
404
|
+
[ducklakeConnection],
|
|
405
|
+
testProjectPath,
|
|
406
|
+
);
|
|
407
|
+
|
|
408
|
+
const connection = malloyConnections.get(
|
|
409
|
+
"ducklake_tables_test",
|
|
410
|
+
) as DuckDBConnection;
|
|
411
|
+
createdConnections.push(connection);
|
|
412
|
+
|
|
413
|
+
// Get schemas first
|
|
414
|
+
const schemas = await getSchemasForConnection(
|
|
415
|
+
ducklakeConnection,
|
|
416
|
+
connection,
|
|
417
|
+
);
|
|
418
|
+
if (schemas.length === 0) {
|
|
419
|
+
console.log("No schemas found, skipping table listing test");
|
|
420
|
+
return;
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
// Test table listing for first schema
|
|
424
|
+
const schemaName = schemas[0].name;
|
|
425
|
+
const tables = await getTablesForSchema(
|
|
426
|
+
ducklakeConnection,
|
|
427
|
+
schemaName,
|
|
428
|
+
connection,
|
|
429
|
+
);
|
|
430
|
+
expect(tables).toBeDefined();
|
|
431
|
+
expect(Array.isArray(tables)).toBe(true);
|
|
432
|
+
},
|
|
433
|
+
{ timeout: 30000 },
|
|
434
|
+
);
|
|
435
|
+
|
|
436
|
+
it(
|
|
437
|
+
"should handle table path prefixing correctly",
|
|
438
|
+
async () => {
|
|
439
|
+
if (!hasPostgresCredentials() || !hasS3Credentials()) {
|
|
440
|
+
console.log(
|
|
441
|
+
"Skipping: PostgreSQL and S3 credentials not configured",
|
|
442
|
+
);
|
|
443
|
+
return;
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
const ducklakeConnection: ApiConnection = {
|
|
447
|
+
name: "ducklake_prefix_test",
|
|
448
|
+
type: "ducklake",
|
|
449
|
+
ducklakeConnection: {
|
|
450
|
+
catalog: {
|
|
451
|
+
postgresConnection: {
|
|
452
|
+
host: process.env.POSTGRES_TEST_HOST,
|
|
453
|
+
port: parseInt(
|
|
454
|
+
process.env.POSTGRES_TEST_PORT || "5432",
|
|
455
|
+
),
|
|
456
|
+
userName: process.env.POSTGRES_TEST_USER!,
|
|
457
|
+
password: process.env.POSTGRES_TEST_PASSWORD!,
|
|
458
|
+
databaseName: process.env.POSTGRES_TEST_DATABASE,
|
|
459
|
+
},
|
|
460
|
+
},
|
|
461
|
+
storage: {
|
|
462
|
+
bucketUrl:
|
|
463
|
+
process.env.S3_TEST_BUCKET_URL || "s3://test-bucket",
|
|
464
|
+
s3Connection: {
|
|
465
|
+
accessKeyId: process.env.S3_TEST_ACCESS_KEY_ID!,
|
|
466
|
+
secretAccessKey: process.env.S3_TEST_SECRET_ACCESS_KEY!,
|
|
467
|
+
region: process.env.S3_TEST_REGION || "us-east-1",
|
|
468
|
+
},
|
|
469
|
+
},
|
|
470
|
+
},
|
|
471
|
+
};
|
|
472
|
+
|
|
473
|
+
const { malloyConnections } = await createProjectConnections(
|
|
474
|
+
[ducklakeConnection],
|
|
475
|
+
testProjectPath,
|
|
476
|
+
);
|
|
477
|
+
|
|
478
|
+
const connection = malloyConnections.get(
|
|
479
|
+
"ducklake_prefix_test",
|
|
480
|
+
) as DuckDBConnection;
|
|
481
|
+
createdConnections.push(connection);
|
|
482
|
+
|
|
483
|
+
// Test that connection name is used as catalog prefix
|
|
484
|
+
// DuckLake tables should be accessible as connectionName.schemaName.tableName
|
|
485
|
+
const result = await connection.runSQL(
|
|
486
|
+
`SELECT catalog_name, schema_name FROM information_schema.schemata WHERE catalog_name = 'ducklake_prefix_test' LIMIT 1`,
|
|
487
|
+
);
|
|
488
|
+
expect(result.rows).toBeDefined();
|
|
489
|
+
},
|
|
490
|
+
{ timeout: 30000 },
|
|
491
|
+
);
|
|
492
|
+
});
|
|
493
|
+
|
|
494
|
+
describe("Query Operations", () => {
|
|
495
|
+
it(
|
|
496
|
+
"should execute queries against DuckLake database",
|
|
497
|
+
async () => {
|
|
498
|
+
if (!hasPostgresCredentials() || !hasS3Credentials()) {
|
|
499
|
+
console.log(
|
|
500
|
+
"Skipping: PostgreSQL and S3 credentials not configured",
|
|
501
|
+
);
|
|
502
|
+
return;
|
|
503
|
+
}
|
|
504
|
+
|
|
505
|
+
const ducklakeConnection: ApiConnection = {
|
|
506
|
+
name: "ducklake_query_test",
|
|
507
|
+
type: "ducklake",
|
|
508
|
+
ducklakeConnection: {
|
|
509
|
+
catalog: {
|
|
510
|
+
postgresConnection: {
|
|
511
|
+
host: process.env.POSTGRES_TEST_HOST,
|
|
512
|
+
port: parseInt(
|
|
513
|
+
process.env.POSTGRES_TEST_PORT || "5432",
|
|
514
|
+
),
|
|
515
|
+
userName: process.env.POSTGRES_TEST_USER!,
|
|
516
|
+
password: process.env.POSTGRES_TEST_PASSWORD!,
|
|
517
|
+
databaseName: process.env.POSTGRES_TEST_DATABASE,
|
|
518
|
+
},
|
|
519
|
+
},
|
|
520
|
+
storage: {
|
|
521
|
+
bucketUrl:
|
|
522
|
+
process.env.S3_TEST_BUCKET_URL || "s3://test-bucket",
|
|
523
|
+
s3Connection: {
|
|
524
|
+
accessKeyId: process.env.S3_TEST_ACCESS_KEY_ID!,
|
|
525
|
+
secretAccessKey: process.env.S3_TEST_SECRET_ACCESS_KEY!,
|
|
526
|
+
region: process.env.S3_TEST_REGION || "us-east-1",
|
|
527
|
+
},
|
|
528
|
+
},
|
|
529
|
+
},
|
|
530
|
+
};
|
|
531
|
+
|
|
532
|
+
const { malloyConnections } = await createProjectConnections(
|
|
533
|
+
[ducklakeConnection],
|
|
534
|
+
testProjectPath,
|
|
535
|
+
);
|
|
536
|
+
|
|
537
|
+
const connection = malloyConnections.get(
|
|
538
|
+
"ducklake_query_test",
|
|
539
|
+
) as DuckDBConnection;
|
|
540
|
+
createdConnections.push(connection);
|
|
541
|
+
|
|
542
|
+
// Test basic query
|
|
543
|
+
const result = await connection.runSQL(
|
|
544
|
+
`SELECT schema_name FROM information_schema.schemata WHERE catalog_name = 'ducklake_query_test' LIMIT 1`,
|
|
545
|
+
);
|
|
546
|
+
expect(result.rows).toBeDefined();
|
|
547
|
+
expect(Array.isArray(result.rows)).toBe(true);
|
|
548
|
+
},
|
|
549
|
+
{ timeout: 30000 },
|
|
550
|
+
);
|
|
551
|
+
});
|
|
552
|
+
|
|
553
|
+
describe("Error Handling", () => {
|
|
554
|
+
it("should throw error if DuckLake catalog connection is missing", async () => {
|
|
555
|
+
await expect(
|
|
556
|
+
createProjectConnections(
|
|
557
|
+
[
|
|
558
|
+
{
|
|
559
|
+
name: "ducklake_no_catalog",
|
|
560
|
+
type: "ducklake",
|
|
561
|
+
ducklakeConnection: {
|
|
562
|
+
storage: {
|
|
563
|
+
bucketUrl: "s3://test-bucket",
|
|
564
|
+
s3Connection: {
|
|
565
|
+
accessKeyId: "test",
|
|
566
|
+
secretAccessKey: "test",
|
|
567
|
+
},
|
|
568
|
+
},
|
|
569
|
+
},
|
|
570
|
+
} as ApiConnection,
|
|
571
|
+
],
|
|
572
|
+
testProjectPath,
|
|
573
|
+
),
|
|
574
|
+
).rejects.toThrow(/PostgreSQL connection configuration is required/);
|
|
575
|
+
});
|
|
576
|
+
|
|
577
|
+
it("should throw error if DuckLake storage bucketUrl is missing", async () => {
|
|
578
|
+
await expect(
|
|
579
|
+
createProjectConnections(
|
|
580
|
+
[
|
|
581
|
+
{
|
|
582
|
+
name: "ducklake_no_bucket",
|
|
583
|
+
type: "ducklake",
|
|
584
|
+
ducklakeConnection: {
|
|
585
|
+
catalog: {
|
|
586
|
+
postgresConnection: {
|
|
587
|
+
host: "localhost",
|
|
588
|
+
port: 5432,
|
|
589
|
+
userName: "test",
|
|
590
|
+
password: "test",
|
|
591
|
+
databaseName: "test",
|
|
592
|
+
},
|
|
593
|
+
},
|
|
594
|
+
storage: {
|
|
595
|
+
s3Connection: {
|
|
596
|
+
accessKeyId: "test",
|
|
597
|
+
secretAccessKey: "test",
|
|
598
|
+
},
|
|
599
|
+
},
|
|
600
|
+
},
|
|
601
|
+
} as ApiConnection,
|
|
602
|
+
],
|
|
603
|
+
testProjectPath,
|
|
604
|
+
),
|
|
605
|
+
).rejects.toThrow(/Storage bucketUrl is required/);
|
|
606
|
+
});
|
|
607
|
+
|
|
608
|
+
it("should throw error if DuckLake connection config is missing", async () => {
|
|
609
|
+
await expect(
|
|
610
|
+
createProjectConnections(
|
|
611
|
+
[
|
|
612
|
+
{
|
|
613
|
+
name: "ducklake_missing_config",
|
|
614
|
+
type: "ducklake",
|
|
615
|
+
},
|
|
616
|
+
],
|
|
617
|
+
testProjectPath,
|
|
618
|
+
),
|
|
619
|
+
).rejects.toThrow(/DuckLake connection configuration is missing/);
|
|
620
|
+
});
|
|
621
|
+
|
|
622
|
+
it("should handle already attached database gracefully", async () => {
|
|
623
|
+
if (!hasPostgresCredentials() || !hasS3Credentials()) {
|
|
624
|
+
console.log(
|
|
625
|
+
"Skipping: PostgreSQL and S3 credentials not configured",
|
|
626
|
+
);
|
|
627
|
+
return;
|
|
628
|
+
}
|
|
629
|
+
|
|
630
|
+
const ducklakeConnection: ApiConnection = {
|
|
631
|
+
name: "ducklake_duplicate_test",
|
|
632
|
+
type: "ducklake",
|
|
633
|
+
ducklakeConnection: {
|
|
634
|
+
catalog: {
|
|
635
|
+
postgresConnection: {
|
|
636
|
+
host: process.env.POSTGRES_TEST_HOST,
|
|
637
|
+
port: parseInt(process.env.POSTGRES_TEST_PORT || "5432"),
|
|
638
|
+
userName: process.env.POSTGRES_TEST_USER!,
|
|
639
|
+
password: process.env.POSTGRES_TEST_PASSWORD!,
|
|
640
|
+
databaseName: process.env.POSTGRES_TEST_DATABASE,
|
|
641
|
+
},
|
|
642
|
+
},
|
|
643
|
+
storage: {
|
|
644
|
+
bucketUrl:
|
|
645
|
+
process.env.S3_TEST_BUCKET_URL || "s3://test-bucket",
|
|
646
|
+
s3Connection: {
|
|
647
|
+
accessKeyId: process.env.S3_TEST_ACCESS_KEY_ID!,
|
|
648
|
+
secretAccessKey: process.env.S3_TEST_SECRET_ACCESS_KEY!,
|
|
649
|
+
region: process.env.S3_TEST_REGION || "us-east-1",
|
|
650
|
+
},
|
|
651
|
+
},
|
|
652
|
+
},
|
|
653
|
+
};
|
|
654
|
+
|
|
655
|
+
// Create connection twice - second should handle already attached gracefully
|
|
656
|
+
const { malloyConnections: conn1 } = await createProjectConnections(
|
|
657
|
+
[ducklakeConnection],
|
|
658
|
+
testProjectPath,
|
|
659
|
+
);
|
|
660
|
+
const connection1 = conn1.get(
|
|
661
|
+
"ducklake_duplicate_test",
|
|
662
|
+
) as DuckDBConnection;
|
|
663
|
+
createdConnections.push(connection1);
|
|
664
|
+
|
|
665
|
+
const { malloyConnections: conn2 } = await createProjectConnections(
|
|
666
|
+
[ducklakeConnection],
|
|
667
|
+
testProjectPath,
|
|
668
|
+
);
|
|
669
|
+
const connection2 = conn2.get(
|
|
670
|
+
"ducklake_duplicate_test",
|
|
671
|
+
) as DuckDBConnection;
|
|
672
|
+
createdConnections.push(connection2);
|
|
673
|
+
|
|
674
|
+
expect(connection1).toBeDefined();
|
|
675
|
+
expect(connection2).toBeDefined();
|
|
676
|
+
});
|
|
677
|
+
});
|
|
678
|
+
|
|
679
|
+
describe("Database File Management", () => {
|
|
680
|
+
it(
|
|
681
|
+
"should create database file with correct naming pattern",
|
|
682
|
+
async () => {
|
|
683
|
+
if (!hasPostgresCredentials() || !hasS3Credentials()) {
|
|
684
|
+
console.log(
|
|
685
|
+
"Skipping: PostgreSQL and S3 credentials not configured",
|
|
686
|
+
);
|
|
687
|
+
return;
|
|
688
|
+
}
|
|
689
|
+
|
|
690
|
+
const ducklakeConnection: ApiConnection = {
|
|
691
|
+
name: "ducklake_file_test",
|
|
692
|
+
type: "ducklake",
|
|
693
|
+
ducklakeConnection: {
|
|
694
|
+
catalog: {
|
|
695
|
+
postgresConnection: {
|
|
696
|
+
host: process.env.POSTGRES_TEST_HOST,
|
|
697
|
+
port: parseInt(
|
|
698
|
+
process.env.POSTGRES_TEST_PORT || "5432",
|
|
699
|
+
),
|
|
700
|
+
userName: process.env.POSTGRES_TEST_USER!,
|
|
701
|
+
password: process.env.POSTGRES_TEST_PASSWORD!,
|
|
702
|
+
databaseName: process.env.POSTGRES_TEST_DATABASE,
|
|
703
|
+
},
|
|
704
|
+
},
|
|
705
|
+
storage: {
|
|
706
|
+
bucketUrl:
|
|
707
|
+
process.env.S3_TEST_BUCKET_URL || "s3://test-bucket",
|
|
708
|
+
s3Connection: {
|
|
709
|
+
accessKeyId: process.env.S3_TEST_ACCESS_KEY_ID!,
|
|
710
|
+
secretAccessKey: process.env.S3_TEST_SECRET_ACCESS_KEY!,
|
|
711
|
+
region: process.env.S3_TEST_REGION || "us-east-1",
|
|
712
|
+
},
|
|
713
|
+
},
|
|
714
|
+
},
|
|
715
|
+
};
|
|
716
|
+
|
|
717
|
+
const { malloyConnections } = await createProjectConnections(
|
|
718
|
+
[ducklakeConnection],
|
|
719
|
+
testProjectPath,
|
|
720
|
+
);
|
|
721
|
+
|
|
722
|
+
const connection = malloyConnections.get(
|
|
723
|
+
"ducklake_file_test",
|
|
724
|
+
) as DuckDBConnection;
|
|
725
|
+
createdConnections.push(connection);
|
|
726
|
+
|
|
727
|
+
// Verify database file follows naming pattern: {connectionName}_ducklake.duckdb
|
|
728
|
+
const dbPath = path.join(
|
|
729
|
+
testProjectPath,
|
|
730
|
+
"ducklake_file_test_ducklake.duckdb",
|
|
731
|
+
);
|
|
732
|
+
const exists = await fs
|
|
733
|
+
.access(dbPath)
|
|
734
|
+
.then(() => true)
|
|
735
|
+
.catch(() => false);
|
|
736
|
+
expect(exists).toBe(true);
|
|
737
|
+
},
|
|
738
|
+
{ timeout: 30000 },
|
|
739
|
+
);
|
|
740
|
+
|
|
741
|
+
it("should delete DuckLake connection file", async () => {
|
|
742
|
+
if (!hasPostgresCredentials() || !hasS3Credentials()) {
|
|
743
|
+
console.log(
|
|
744
|
+
"Skipping: PostgreSQL and S3 credentials not configured",
|
|
745
|
+
);
|
|
746
|
+
return;
|
|
747
|
+
}
|
|
748
|
+
|
|
749
|
+
const ducklakeConnection: ApiConnection = {
|
|
750
|
+
name: "ducklake_delete_test",
|
|
751
|
+
type: "ducklake",
|
|
752
|
+
ducklakeConnection: {
|
|
753
|
+
catalog: {
|
|
754
|
+
postgresConnection: {
|
|
755
|
+
host: process.env.POSTGRES_TEST_HOST,
|
|
756
|
+
port: parseInt(process.env.POSTGRES_TEST_PORT || "5432"),
|
|
757
|
+
userName: process.env.POSTGRES_TEST_USER!,
|
|
758
|
+
password: process.env.POSTGRES_TEST_PASSWORD!,
|
|
759
|
+
databaseName: process.env.POSTGRES_TEST_DATABASE,
|
|
760
|
+
},
|
|
761
|
+
},
|
|
762
|
+
storage: {
|
|
763
|
+
bucketUrl:
|
|
764
|
+
process.env.S3_TEST_BUCKET_URL || "s3://test-bucket",
|
|
765
|
+
s3Connection: {
|
|
766
|
+
accessKeyId: process.env.S3_TEST_ACCESS_KEY_ID!,
|
|
767
|
+
secretAccessKey: process.env.S3_TEST_SECRET_ACCESS_KEY!,
|
|
768
|
+
region: process.env.S3_TEST_REGION || "us-east-1",
|
|
769
|
+
},
|
|
770
|
+
},
|
|
771
|
+
},
|
|
772
|
+
};
|
|
773
|
+
|
|
774
|
+
const { malloyConnections } = await createProjectConnections(
|
|
775
|
+
[ducklakeConnection],
|
|
776
|
+
testProjectPath,
|
|
777
|
+
);
|
|
778
|
+
|
|
779
|
+
const connection = malloyConnections.get(
|
|
780
|
+
"ducklake_delete_test",
|
|
781
|
+
) as DuckDBConnection;
|
|
782
|
+
await connection.close();
|
|
783
|
+
createdConnections = createdConnections.filter(
|
|
784
|
+
(c) => c !== connection,
|
|
785
|
+
);
|
|
786
|
+
|
|
787
|
+
// Delete the file
|
|
788
|
+
await deleteDuckLakeConnectionFile(
|
|
789
|
+
"ducklake_delete_test",
|
|
790
|
+
testProjectPath,
|
|
791
|
+
);
|
|
792
|
+
|
|
793
|
+
// Verify file is deleted
|
|
794
|
+
const dbPath = path.join(
|
|
795
|
+
testProjectPath,
|
|
796
|
+
"ducklake_delete_test_ducklake.duckdb",
|
|
797
|
+
);
|
|
798
|
+
const exists = await fs
|
|
799
|
+
.access(dbPath)
|
|
800
|
+
.then(() => true)
|
|
801
|
+
.catch(() => false);
|
|
802
|
+
expect(exists).toBe(false);
|
|
803
|
+
});
|
|
804
|
+
|
|
805
|
+
it("should handle deletion of non-existent file gracefully", async () => {
|
|
806
|
+
// Should not throw error if file doesn't exist
|
|
807
|
+
// The function catches ENOENT errors internally, so this should complete without throwing
|
|
808
|
+
await expect(
|
|
809
|
+
deleteDuckLakeConnectionFile(
|
|
810
|
+
"nonexistent_connection",
|
|
811
|
+
testProjectPath,
|
|
812
|
+
),
|
|
813
|
+
).resolves.toBeUndefined();
|
|
814
|
+
});
|
|
815
|
+
});
|
|
816
|
+
|
|
817
|
+
describe("Connection Testing", () => {
|
|
818
|
+
it(
|
|
819
|
+
"should test DuckLake connection configuration",
|
|
820
|
+
async () => {
|
|
821
|
+
if (!hasPostgresCredentials() || !hasS3Credentials()) {
|
|
822
|
+
console.log(
|
|
823
|
+
"Skipping: PostgreSQL and S3 credentials not configured",
|
|
824
|
+
);
|
|
825
|
+
return;
|
|
826
|
+
}
|
|
827
|
+
|
|
828
|
+
const result = await testConnectionConfig({
|
|
829
|
+
name: "ducklake_test_config",
|
|
830
|
+
type: "ducklake",
|
|
831
|
+
ducklakeConnection: {
|
|
832
|
+
catalog: {
|
|
833
|
+
postgresConnection: {
|
|
834
|
+
host: process.env.POSTGRES_TEST_HOST,
|
|
835
|
+
port: parseInt(
|
|
836
|
+
process.env.POSTGRES_TEST_PORT || "5432",
|
|
837
|
+
),
|
|
838
|
+
userName: process.env.POSTGRES_TEST_USER!,
|
|
839
|
+
password: process.env.POSTGRES_TEST_PASSWORD!,
|
|
840
|
+
databaseName: process.env.POSTGRES_TEST_DATABASE,
|
|
841
|
+
},
|
|
842
|
+
},
|
|
843
|
+
storage: {
|
|
844
|
+
bucketUrl:
|
|
845
|
+
process.env.S3_TEST_BUCKET_URL || "s3://test-bucket",
|
|
846
|
+
s3Connection: {
|
|
847
|
+
accessKeyId: process.env.S3_TEST_ACCESS_KEY_ID!,
|
|
848
|
+
secretAccessKey: process.env.S3_TEST_SECRET_ACCESS_KEY!,
|
|
849
|
+
region: process.env.S3_TEST_REGION || "us-east-1",
|
|
850
|
+
},
|
|
851
|
+
},
|
|
852
|
+
},
|
|
853
|
+
});
|
|
854
|
+
|
|
855
|
+
expect(result.status).toBe("ok");
|
|
856
|
+
expect(result.errorMessage).toBe("");
|
|
857
|
+
},
|
|
858
|
+
{ timeout: 30000 },
|
|
859
|
+
);
|
|
860
|
+
|
|
861
|
+
it(
|
|
862
|
+
"should fail test for invalid DuckLake configuration",
|
|
863
|
+
async () => {
|
|
864
|
+
const result = await testConnectionConfig({
|
|
865
|
+
name: "ducklake_invalid_test",
|
|
866
|
+
type: "ducklake",
|
|
867
|
+
ducklakeConnection: {
|
|
868
|
+
catalog: {
|
|
869
|
+
postgresConnection: {
|
|
870
|
+
host: "invalid-host",
|
|
871
|
+
port: 5432,
|
|
872
|
+
userName: "invalid",
|
|
873
|
+
password: "invalid",
|
|
874
|
+
databaseName: "invalid",
|
|
875
|
+
},
|
|
876
|
+
},
|
|
877
|
+
storage: {
|
|
878
|
+
bucketUrl: "s3://invalid-bucket",
|
|
879
|
+
s3Connection: {
|
|
880
|
+
accessKeyId: "invalid",
|
|
881
|
+
secretAccessKey: "invalid",
|
|
882
|
+
},
|
|
883
|
+
},
|
|
884
|
+
},
|
|
885
|
+
});
|
|
886
|
+
|
|
887
|
+
expect(result.status).toBe("failed");
|
|
888
|
+
expect(result.errorMessage).toBeDefined();
|
|
889
|
+
expect(result.errorMessage.length).toBeGreaterThan(0);
|
|
890
|
+
},
|
|
891
|
+
{ timeout: 30000 },
|
|
892
|
+
);
|
|
893
|
+
});
|
|
894
|
+
|
|
895
|
+
describe("Connection Attributes", () => {
|
|
896
|
+
it(
|
|
897
|
+
"should return correct attributes for DuckLake connection",
|
|
898
|
+
async () => {
|
|
899
|
+
if (!hasPostgresCredentials() || !hasS3Credentials()) {
|
|
900
|
+
console.log(
|
|
901
|
+
"Skipping: PostgreSQL and S3 credentials not configured",
|
|
902
|
+
);
|
|
903
|
+
return;
|
|
904
|
+
}
|
|
905
|
+
|
|
906
|
+
const { apiConnections } = await createProjectConnections(
|
|
907
|
+
[
|
|
908
|
+
{
|
|
909
|
+
name: "ducklake_attrs_test",
|
|
910
|
+
type: "ducklake",
|
|
911
|
+
ducklakeConnection: {
|
|
912
|
+
catalog: {
|
|
913
|
+
postgresConnection: {
|
|
914
|
+
host: process.env.POSTGRES_TEST_HOST,
|
|
915
|
+
port: parseInt(
|
|
916
|
+
process.env.POSTGRES_TEST_PORT || "5432",
|
|
917
|
+
),
|
|
918
|
+
userName: process.env.POSTGRES_TEST_USER!,
|
|
919
|
+
password: process.env.POSTGRES_TEST_PASSWORD!,
|
|
920
|
+
databaseName: process.env.POSTGRES_TEST_DATABASE,
|
|
921
|
+
},
|
|
922
|
+
},
|
|
923
|
+
storage: {
|
|
924
|
+
bucketUrl:
|
|
925
|
+
process.env.S3_TEST_BUCKET_URL ||
|
|
926
|
+
"s3://test-bucket",
|
|
927
|
+
s3Connection: {
|
|
928
|
+
accessKeyId: process.env.S3_TEST_ACCESS_KEY_ID!,
|
|
929
|
+
secretAccessKey:
|
|
930
|
+
process.env.S3_TEST_SECRET_ACCESS_KEY!,
|
|
931
|
+
region: process.env.S3_TEST_REGION || "us-east-1",
|
|
932
|
+
},
|
|
933
|
+
},
|
|
934
|
+
},
|
|
935
|
+
},
|
|
936
|
+
],
|
|
937
|
+
testProjectPath,
|
|
938
|
+
);
|
|
939
|
+
|
|
940
|
+
const connection = apiConnections[0];
|
|
941
|
+
expect(connection.attributes).toBeDefined();
|
|
942
|
+
expect(connection.attributes?.dialectName).toBe("duckdb");
|
|
943
|
+
expect(typeof connection.attributes?.canPersist).toBe("boolean");
|
|
944
|
+
expect(typeof connection.attributes?.canStream).toBe("boolean");
|
|
945
|
+
expect(typeof connection.attributes?.isPool).toBe("boolean");
|
|
946
|
+
},
|
|
947
|
+
{ timeout: 30000 },
|
|
948
|
+
);
|
|
949
|
+
});
|
|
950
|
+
});
|