@fabricorg/databricks-testkit 0.2.2 → 0.2.4
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/dist/{chunk-FBADA7LQ.js → chunk-SCVVMUAF.js} +50 -3
- package/dist/chunk-SCVVMUAF.js.map +1 -0
- package/dist/index.cjs +75 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +30 -5
- package/dist/index.js.map +1 -1
- package/dist/parity.cjs +48 -1
- package/dist/parity.cjs.map +1 -1
- package/dist/parity.js +1 -1
- package/dist/{workspace-context-AIUYISUS.js → workspace-context-VLBKMX3V.js} +3 -3
- package/dist/{workspace-context-AIUYISUS.js.map → workspace-context-VLBKMX3V.js.map} +1 -1
- package/package.json +2 -2
- package/dist/chunk-FBADA7LQ.js.map +0 -1
package/dist/index.d.cts
CHANGED
|
@@ -131,7 +131,8 @@ declare function toNamedParameters(sql: string, params: readonly unknown[]): {
|
|
|
131
131
|
declare function parseStatementRows(response: StatementResponse): Record<string, unknown>[];
|
|
132
132
|
/**
|
|
133
133
|
* Auth precedence (ADR-0006): DATABRICKS_BEARER (pre-minted, CI) →
|
|
134
|
-
*
|
|
134
|
+
* explicit env/file OIDC federation → DATABRICKS_CLIENT_ID/SECRET (OAuth
|
|
135
|
+
* M2M) → DATABRICKS_TOKEN (legacy PAT).
|
|
135
136
|
*/
|
|
136
137
|
declare function createClientFromEnv(env: Record<string, string | undefined>, fetchImpl?: typeof fetch): DatabricksRestClient;
|
|
137
138
|
declare function resolveTokenProvider(host: string, env: Record<string, string | undefined>, fetchImpl?: typeof fetch): string | (() => Promise<string>);
|
package/dist/index.d.ts
CHANGED
|
@@ -131,7 +131,8 @@ declare function toNamedParameters(sql: string, params: readonly unknown[]): {
|
|
|
131
131
|
declare function parseStatementRows(response: StatementResponse): Record<string, unknown>[];
|
|
132
132
|
/**
|
|
133
133
|
* Auth precedence (ADR-0006): DATABRICKS_BEARER (pre-minted, CI) →
|
|
134
|
-
*
|
|
134
|
+
* explicit env/file OIDC federation → DATABRICKS_CLIENT_ID/SECRET (OAuth
|
|
135
|
+
* M2M) → DATABRICKS_TOKEN (legacy PAT).
|
|
135
136
|
*/
|
|
136
137
|
declare function createClientFromEnv(env: Record<string, string | undefined>, fetchImpl?: typeof fetch): DatabricksRestClient;
|
|
137
138
|
declare function resolveTokenProvider(host: string, env: Record<string, string | undefined>, fetchImpl?: typeof fetch): string | (() => Promise<string>);
|
package/dist/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { compareToGolden } from './chunk-MLBZCHRM.js';
|
|
2
2
|
export { compareToGolden } from './chunk-MLBZCHRM.js';
|
|
3
3
|
export { createDuckDbContext, normalizeRow } from './chunk-7JVDOSBO.js';
|
|
4
|
-
import { createClientFromEnv, createWorkspaceContext, resolveTokenProvider } from './chunk-
|
|
5
|
-
export { createClientFromEnv, createWorkspaceContext, parseStatementRows, resolveTokenProvider, toNamedParameters } from './chunk-
|
|
4
|
+
import { createClientFromEnv, createWorkspaceContext, resolveTokenProvider } from './chunk-SCVVMUAF.js';
|
|
5
|
+
export { createClientFromEnv, createWorkspaceContext, parseStatementRows, resolveTokenProvider, toNamedParameters } from './chunk-SCVVMUAF.js';
|
|
6
6
|
export { parseFixtureColumns, resolveFixtureRows } from './chunk-F3KU6VZS.js';
|
|
7
7
|
import { mkdir, writeFile, readFile } from 'fs/promises';
|
|
8
8
|
import { dirname, resolve, basename } from 'path';
|
|
@@ -31,7 +31,7 @@ async function createExecutionContext(options = {}) {
|
|
|
31
31
|
const { createDuckDbContext: createDuckDbContext2 } = await import('./duckdb-context-FX23RUBV.js');
|
|
32
32
|
return createDuckDbContext2({ schema: options.schema });
|
|
33
33
|
}
|
|
34
|
-
const { createWorkspaceContext: createWorkspaceContext2 } = await import('./workspace-context-
|
|
34
|
+
const { createWorkspaceContext: createWorkspaceContext2 } = await import('./workspace-context-VLBKMX3V.js');
|
|
35
35
|
return createWorkspaceContext2({
|
|
36
36
|
env,
|
|
37
37
|
schema: options.schema,
|
|
@@ -150,7 +150,7 @@ async function runLiveSuite(spec, runtime = {}) {
|
|
|
150
150
|
const startedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
151
151
|
const ownedWarehouse = runtime.warehouse === void 0;
|
|
152
152
|
const client = runtime.client ?? createClientFromEnv(env);
|
|
153
|
-
const warehouse = runtime.warehouse ?? await createWorkspaceContext({ env, client });
|
|
153
|
+
const warehouse = runtime.warehouse ?? (hasWarehouseConfig(env) ? await createWorkspaceContext({ env, client }) : unavailableWarehouseContext());
|
|
154
154
|
const results = [];
|
|
155
155
|
try {
|
|
156
156
|
for (const check of spec.checks) {
|
|
@@ -204,6 +204,24 @@ async function runLiveSuite(spec, runtime = {}) {
|
|
|
204
204
|
if (spec.junitPath) await writeReport(spec.junitPath, renderJUnit(evidence));
|
|
205
205
|
return evidence;
|
|
206
206
|
}
|
|
207
|
+
function hasWarehouseConfig(env) {
|
|
208
|
+
return Boolean(env.DATABRICKS_WAREHOUSE_ID || env.DATABRICKS_HTTP_PATH);
|
|
209
|
+
}
|
|
210
|
+
function unavailableWarehouseContext() {
|
|
211
|
+
const unavailable = async () => {
|
|
212
|
+
throw new Error(
|
|
213
|
+
"This live check requires DATABRICKS_WAREHOUSE_ID or DATABRICKS_HTTP_PATH; REST-only checks can run without SQL warehouse configuration"
|
|
214
|
+
);
|
|
215
|
+
};
|
|
216
|
+
return {
|
|
217
|
+
profile: "live",
|
|
218
|
+
qual: (table) => table,
|
|
219
|
+
exec: unavailable,
|
|
220
|
+
query: unavailable,
|
|
221
|
+
loadFixture: unavailable,
|
|
222
|
+
close: async () => void 0
|
|
223
|
+
};
|
|
224
|
+
}
|
|
207
225
|
async function writeReport(path, contents) {
|
|
208
226
|
await mkdir(dirname(path), { recursive: true });
|
|
209
227
|
await writeFile(path, contents, "utf8");
|
|
@@ -278,6 +296,7 @@ function sqlRoundTripCheck() {
|
|
|
278
296
|
return {
|
|
279
297
|
id: "sql",
|
|
280
298
|
description: "SQL Statement Execution round-trip",
|
|
299
|
+
configured: (env) => Boolean(env.DATABRICKS_WAREHOUSE_ID || env.DATABRICKS_HTTP_PATH),
|
|
281
300
|
async run({ warehouse }) {
|
|
282
301
|
const rows = await warehouse.query("SELECT 1 AS dbx_test_ok");
|
|
283
302
|
if (Number(rows[0]?.dbx_test_ok) !== 1)
|
|
@@ -881,6 +900,7 @@ function failureRecoveryCheck() {
|
|
|
881
900
|
return {
|
|
882
901
|
id: "failure-recovery",
|
|
883
902
|
description: "A failed statement is isolated and a subsequent statement recovers",
|
|
903
|
+
configured: (env) => Boolean(env.DATABRICKS_WAREHOUSE_ID || env.DATABRICKS_HTTP_PATH),
|
|
884
904
|
async run({ warehouse }) {
|
|
885
905
|
let failedAsExpected = false;
|
|
886
906
|
try {
|
|
@@ -926,6 +946,7 @@ function backupRestoreCheck() {
|
|
|
926
946
|
return {
|
|
927
947
|
id: "backup-restore",
|
|
928
948
|
description: "Delta DEEP CLONE backup restores a dropped scratch table",
|
|
949
|
+
configured: (env) => Boolean(env.DATABRICKS_WAREHOUSE_ID || env.DATABRICKS_HTTP_PATH),
|
|
929
950
|
async run({ warehouse }) {
|
|
930
951
|
const source = warehouse.qual(safeName("backup_source"));
|
|
931
952
|
const backup = warehouse.qual(safeName("backup_clone"));
|
|
@@ -948,6 +969,7 @@ function rollbackCheck() {
|
|
|
948
969
|
return {
|
|
949
970
|
id: "rollback",
|
|
950
971
|
description: "Delta time-travel rollback restores a known-good table version",
|
|
972
|
+
configured: (env) => Boolean(env.DATABRICKS_WAREHOUSE_ID || env.DATABRICKS_HTTP_PATH),
|
|
951
973
|
async run({ warehouse }) {
|
|
952
974
|
const table = warehouse.qual(safeName("rollback_probe"));
|
|
953
975
|
try {
|
|
@@ -1036,7 +1058,10 @@ function classicComputeCheck() {
|
|
|
1036
1058
|
});
|
|
1037
1059
|
const result = run.state?.result_state;
|
|
1038
1060
|
if (result !== "SUCCESS") {
|
|
1039
|
-
|
|
1061
|
+
const message = run.state?.state_message;
|
|
1062
|
+
throw new Error(
|
|
1063
|
+
`Classic compute run ${submitted.run_id} ended in ${result ?? "UNKNOWN"}${message ? `: ${message}` : ""}`
|
|
1064
|
+
);
|
|
1040
1065
|
}
|
|
1041
1066
|
return {
|
|
1042
1067
|
runId: submitted.run_id,
|