Skip to content
14 changes: 12 additions & 2 deletions packages/cubejs-testing-drivers/fixtures/redshift.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
"CUBEJS_DB_NAME": "dev",
"CUBEJS_DB_USER": "${DRIVERS_TESTS_CUBEJS_DB_REDSHIFT_USER}",
"CUBEJS_DB_PASS": "${DRIVERS_TESTS_CUBEJS_DB_REDSHIFT_PASS}",
"CUBEJS_DB_MAX_POOL": "2",
"CUBEJS_DB_QUERY_TIMEOUT": "15m",

"CUBEJS_PG_SQL_PORT": "5656",
"CUBEJS_SQL_USER": "admin",
Expand Down Expand Up @@ -193,7 +195,11 @@
"---------------------------------------",
"SKIPPED SQL API (Need work) ",
"---------------------------------------",
"SQL API: SQL push down push to cube quoted alias"
"SQL API: SQL push down push to cube quoted alias",

"Skipped because are too heavy and leads to Connection terminated unexpectedly or ECONNREFUSED or ECONNRESET",
"SQL API: Rolling Window YTD (year + month + day + date_trunc equal)",
"SQL API: Rolling Window YTD (year + month + day + date_trunc IN)"
],
"tesseractSkip": [
"querying custom granularities ECommerce: count by three_months_by_march + no dimension",
Expand Down Expand Up @@ -226,6 +232,10 @@
"---- Different results comparing to baseQuery version. Need to investigate ----",
"querying BigECommerce: rolling window YTD (month + week)",
"querying BigECommerce: rolling window YTD (month + week + no gran)",
"querying BigECommerce: rolling window YTD without granularity"
"querying BigECommerce: rolling window YTD without granularity",

"Skipped because are too heavy and leads to Connection terminated unexpectedly or ECONNREFUSED or ECONNRESET",
"SQL API: Rolling Window YTD (year + month + day + date_trunc equal)",
"SQL API: Rolling Window YTD (year + month + day + date_trunc IN)"
]
}
29 changes: 28 additions & 1 deletion packages/cubejs-testing-drivers/src/tests/testQueries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,17 @@ type TestQueriesOptions = {
externalSchemaTests?: boolean,
};

export const delay = (ms: number) => new Promise((resolve) => setTimeout(resolve, ms));

const OP_DELAY = 1000;

export function testQueries(type: string, { includeIncrementalSchemaSuite, extendedEnv, includeHLLSuite, externalSchemaTests }: TestQueriesOptions = {}): void {
describe(`Queries with the @cubejs-backend/${type}-driver${extendedEnv ? ` ${extendedEnv}` : ''}`, () => {
jest.setTimeout(60 * 5 * 1000);
if (type.includes('redshift')) {
jest.setTimeout(60 * 15 * 1000);
} else {
jest.setTimeout(60 * 5 * 1000);
}

const isTesseractEnv = get('DRIVERS_TESTS_CUBEJS_TESSERACT_SQL_PLANNER').default('false').asBool();

Expand Down Expand Up @@ -94,6 +102,10 @@ export function testQueries(type: string, { includeIncrementalSchemaSuite, exten
await test(connection);
} finally {
await connection.end();

if (type.includes('redshift')) {
await delay(OP_DELAY);
}
}
});
}
Expand Down Expand Up @@ -127,6 +139,9 @@ export function testQueries(type: string, { includeIncrementalSchemaSuite, exten
try {
for (const q of queries) {
await driver.createTableRaw(q);
if (type.includes('redshift')) {
await delay(10 * OP_DELAY);
}
}
console.log(`Creating ${queries.length} fixture tables completed`);
} catch (e: any) {
Expand Down Expand Up @@ -156,36 +171,48 @@ export function testQueries(type: string, { includeIncrementalSchemaSuite, exten
contexts: [{ securityContext: { tenant: 't1' } }],
});

await delay(OP_DELAY);

await buildPreaggs(env.cube.port, apiToken, {
timezones: ['UTC'],
preAggregations: ['ECommerce.SAExternal'],
contexts: [{ securityContext: { tenant: 't1' } }],
});

await delay(OP_DELAY);

await buildPreaggs(env.cube.port, apiToken, {
timezones: ['UTC'],
preAggregations: ['ECommerce.TAExternal'],
contexts: [{ securityContext: { tenant: 't1' } }],
});

await delay(OP_DELAY);

await buildPreaggs(env.cube.port, apiToken, {
timezones: ['UTC'],
preAggregations: ['BigECommerce.TAExternal'],
contexts: [{ securityContext: { tenant: 't1' } }],
});

await delay(OP_DELAY);

await buildPreaggs(env.cube.port, apiToken, {
timezones: ['UTC'],
preAggregations: ['BigECommerce.MultiTimeDimForCountExternal'],
contexts: [{ securityContext: { tenant: 't1' } }],
});

await delay(OP_DELAY);

if (includeHLLSuite) {
await buildPreaggs(env.cube.port, apiToken, {
timezones: ['UTC'],
preAggregations: ['BigECommerce.CountByProductExternal'],
contexts: [{ securityContext: { tenant: 't1' } }],
});

await delay(OP_DELAY);
}
});

Expand Down
Loading