MCPcopy Create free account
hub / github.com/dataform-co/dataform / test

Function test

cli/api/commands/credentials.ts:37–60  ·  view source on GitHub ↗
(
  dbadapter: dbadapters.IDbAdapter,
  timeoutMs: number = 10000
)

Source from the content-addressed store, hash-verified

35}
36
37export async function test(
38 dbadapter: dbadapters.IDbAdapter,
39 timeoutMs: number = 10000
40): Promise<ITestResult> {
41 let timer;
42 try {
43 const timeout = new Promise<TestResultStatus>(
44 resolve => (timer = setTimeout(() => resolve(TestResultStatus.TIMED_OUT), timeoutMs))
45 );
46 const executeQuery = dbadapter.execute("SELECT 1 AS x").then(() => TestResultStatus.SUCCESSFUL);
47 return {
48 status: await Promise.race([executeQuery, timeout])
49 };
50 } catch (e) {
51 return {
52 status: TestResultStatus.OTHER_ERROR,
53 error: e
54 };
55 } finally {
56 if (timer) {
57 clearTimeout(timer);
58 }
59 }
60}

Callers

nothing calls this directly

Calls 2

thenMethod · 0.80
executeMethod · 0.65

Tested by

no test coverage detected