Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(testing-drivers): arrange tables creation/removal in incrementalSchemaLoading test #7177

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ export function testIncrementalSchemaLoading(type: string): void {
options: { highWaterMark: number },
) => Promise<any>
};
let query: string[];
let env: Environment;
let inputSchemas: QuerySchemasResult[];
let inputTables: QueryTablesResult[];
Expand All @@ -47,23 +46,35 @@ export function testIncrementalSchemaLoading(type: string): void {
process.env.CUBEJS_DB_PORT = `${env.data.port}`;
}
driver = (await getDriver(type)).source;
const queries = getCreateQueries(type, suffix);
console.log(`Creating ${queries.length} fixture tables`);
try {
for (const q of queries) {
await driver.query(q);
}
console.log(`Creating ${queries.length} fixture tables completed`);
} catch (e: any) {
console.log('Error creating fixtures', e.stack);
throw e;
}
});

afterAll(async () => {
await driver.release();
await env.stop();
try {
console.log(`Dropping ${tables.length} fixture tables`);
for (const t of tables) {
await driver.dropTable(t);
}
console.log(`Dropping ${tables.length} fixture tables completed`);
} finally {
await driver.release();
await env.stop();
}
});

execute('should establish a connection', async () => {
await driver.testConnection();
});

execute('should create the data source', async () => {
query = getCreateQueries(type, suffix);
await Promise.all(query.map(async (q) => {
await driver.query(q);
}));
});

execute('should load and check driver capabilities', async () => {
const capabilities = driver.capabilities();
Expand Down Expand Up @@ -104,13 +115,5 @@ export function testIncrementalSchemaLoading(type: string): void {
data_type: expect.any(String),
});
});

execute('should delete the data source', async () => {
await Promise.all(
tables.map(async (t) => {
await driver.dropTable(t);
})
);
});
});
}
Loading