Skip to content

Commit 9d6ab17

Browse files
authored
chore(firebolt-driver): Setup CI tests (#9019)
* chore(firebolt-driver): code polishment and fix lint warnings * fix running tests * chore(firebolt-driver): setup CI tests
1 parent 504e0a9 commit 9d6ab17

File tree

7 files changed

+72
-40
lines changed

7 files changed

+72
-40
lines changed
+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/bin/bash
2+
set -eo pipefail
3+
4+
# Debug log for test containers
5+
export DEBUG=testcontainers
6+
7+
echo "::group::Firebolt [cloud]"
8+
yarn lerna run --concurrency 1 --stream --no-prefix integration:firebolt
9+
10+
echo "::endgroup::"

.github/workflows/push.yml

+8-1
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,7 @@ jobs:
319319
node-version: [20.x]
320320
db: [
321321
'clickhouse', 'druid', 'elasticsearch', 'mssql', 'mysql', 'postgres', 'prestodb',
322-
'mysql-aurora-serverless', 'crate', 'mongobi'
322+
'mysql-aurora-serverless', 'crate', 'mongobi', 'firebolt'
323323
]
324324
fail-fast: false
325325

@@ -370,6 +370,13 @@ jobs:
370370
retry_wait_seconds: 15
371371
timeout_minutes: 30
372372
command: ./.github/actions/integration/${{ matrix.db }}.sh
373+
env:
374+
# Firebolt Integration
375+
DRIVERS_TESTS_FIREBOLT_CUBEJS_FIREBOLT_ENGINE_NAME: ${{ secrets.DRIVERS_TESTS_FIREBOLT_CUBEJS_FIREBOLT_ENGINE_NAME }}
376+
DRIVERS_TESTS_FIREBOLT_CUBEJS_DB_NAME: ${{ secrets.DRIVERS_TESTS_FIREBOLT_CUBEJS_DB_NAME }}
377+
DRIVERS_TESTS_FIREBOLT_CUBEJS_FIREBOLT_ACCOUNT: ${{ secrets.DRIVERS_TESTS_FIREBOLT_CUBEJS_FIREBOLT_ACCOUNT }}
378+
DRIVERS_TESTS_FIREBOLT_CUBEJS_DB_USER: ${{ secrets.DRIVERS_TESTS_FIREBOLT_CUBEJS_DB_USER }}
379+
DRIVERS_TESTS_FIREBOLT_CUBEJS_DB_PASS: ${{ secrets.DRIVERS_TESTS_FIREBOLT_CUBEJS_DB_PASS }}
373380

374381
integration-smoke:
375382
needs: [ latest-tag-sha, build-cubestore ]

packages/cubejs-firebolt-driver/package.json

+5-2
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
"watch": "tsc -w",
2424
"test": "yarn integration",
2525
"integration": "npm run integration:firebolt",
26-
"integration:firebolt": "jest --verbose dist/test",
26+
"integration:firebolt": "jest --verbose dist/test --runInBand",
2727
"lint": "eslint src/* --ext .ts",
2828
"lint:fix": "eslint --fix src/* --ext .ts"
2929
},
@@ -43,7 +43,10 @@
4343
"access": "public"
4444
},
4545
"jest": {
46-
"testEnvironment": "node"
46+
"testEnvironment": "node",
47+
"setupFiles": [
48+
"./test/test-env.js"
49+
]
4750
},
4851
"eslintConfig": {
4952
"extends": "../cubejs-linter"

packages/cubejs-firebolt-driver/test/FireboltQuery.test.ts

+32-34
Original file line numberDiff line numberDiff line change
@@ -70,50 +70,48 @@ cube(\`sales\`, {
7070
measures: ['sales.count'],
7171
filters: [
7272
{
73-
member: "sales.isShiped",
74-
operator: "equals",
75-
values: ["true"]
73+
member: 'sales.isShiped',
74+
operator: 'equals',
75+
values: ['true']
7676
}
7777
]
7878
}
79-
)
79+
);
8080

8181
const queryAndParams = query.buildSqlAndParams();
8282

8383
expect(queryAndParams[0]).toContain(
8484
'("sales".is_shiped = CAST(? AS BOOLEAN))'
8585
);
8686

87-
expect(queryAndParams[1]).toEqual(["true"]);
88-
}))
89-
it("should cast timestamp", () =>
90-
compiler.compile().then(() => {
91-
const query = new FireboltQuery(
92-
{ joinGraph, cubeEvaluator, compiler },
93-
{
94-
measures: ["sales.count"],
95-
timeDimensions: [
96-
{
97-
dimension: "sales.salesDatetime",
98-
granularity: "day",
99-
dateRange: ["2017-01-01", "2017-01-02"],
100-
},
101-
],
102-
timezone: "America/Los_Angeles",
103-
order: [
104-
{
105-
id: "sales.salesDatetime",
106-
},
107-
],
108-
}
109-
);
110-
111-
const queryAndParams = query.buildSqlAndParams();
87+
expect(queryAndParams[1]).toEqual(['true']);
88+
}));
11289

113-
expect(queryAndParams[0]).toContain(
114-
'("sales".sales_datetime >= ?::timestamptz AND "sales".sales_datetime <= ?::timestamptz)'
115-
);
116-
}));
90+
it('should cast timestamp', () => compiler.compile().then(() => {
91+
const query = new FireboltQuery(
92+
{ joinGraph, cubeEvaluator, compiler },
93+
{
94+
measures: ['sales.count'],
95+
timeDimensions: [
96+
{
97+
dimension: 'sales.salesDatetime',
98+
granularity: 'day',
99+
dateRange: ['2017-01-01', '2017-01-02'],
100+
},
101+
],
102+
timezone: 'America/Los_Angeles',
103+
order: [
104+
{
105+
id: 'sales.salesDatetime',
106+
},
107+
],
108+
}
109+
);
117110

111+
const queryAndParams = query.buildSqlAndParams();
118112

119-
})
113+
expect(queryAndParams[0]).toContain(
114+
'("sales".sales_datetime >= ?::timestamptz AND "sales".sales_datetime <= ?::timestamptz)'
115+
);
116+
}));
117+
});

packages/cubejs-firebolt-driver/test/autostart.test.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
import {assertDataSource, getEnv} from '@cubejs-backend/shared';
1+
import { assertDataSource, getEnv } from '@cubejs-backend/shared';
22
import { DriverTests } from '@cubejs-backend/testing-shared';
33

4-
import { FireboltDriver } from '../src';
54
import { Firebolt } from 'firebolt-sdk';
65
import { version } from 'firebolt-sdk/package.json';
6+
import { FireboltDriver } from '../src';
77

88
describe('FireboltDriver autostart', () => {
99
let tests: DriverTests;
@@ -43,7 +43,7 @@ describe('FireboltDriver autostart', () => {
4343
const engineName = getEnv('fireboltEngineName', { dataSource });
4444
const firebolt = Firebolt({
4545
apiEndpoint: getEnv('fireboltApiEndpoint', { dataSource }) || 'api.app.firebolt.io',
46-
})
46+
});
4747
await firebolt.connect({
4848
auth,
4949
database: getEnv('dbName', { dataSource }),
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
const REQUIRED_ENV_VARS = [
2+
'CUBEJS_DB_USER',
3+
'CUBEJS_DB_PASS',
4+
'CUBEJS_DB_NAME',
5+
'CUBEJS_FIREBOLT_ENGINE_NAME',
6+
'CUBEJS_FIREBOLT_ACCOUNT',
7+
];
8+
9+
REQUIRED_ENV_VARS.forEach((key) => {
10+
// Trying to populate from DRIVERS_TESTS_FIREBOLT_* vars
11+
if (process.env[`DRIVERS_TESTS_FIREBOLT_${key}`] !== undefined) {
12+
process.env[key] = process.env[`DRIVERS_TESTS_FIREBOLT_${key}`];
13+
}
14+
});

0 commit comments

Comments
 (0)