From 08842645a3bede716e587cdad331df6f6bcea572 Mon Sep 17 00:00:00 2001 From: Konstantin Burkalev Date: Thu, 5 Dec 2024 18:30:47 +0200 Subject: [PATCH] chore(firebolt-driver): setup CI tests --- .github/actions/integration/firebolt.sh | 10 ++++++ .github/workflows/push.yml | 2 +- packages/cubejs-firebolt-driver/package.json | 3 +- ...irebolt.test.ts => FireboltDriver.test.ts} | 0 .../cubejs-firebolt-driver/test/test-env.js | 23 ++++++++++++++ yarn.lock | 31 +++++++++++++++++-- 6 files changed, 64 insertions(+), 5 deletions(-) create mode 100755 .github/actions/integration/firebolt.sh rename packages/cubejs-firebolt-driver/test/{Firebolt.test.ts => FireboltDriver.test.ts} (100%) create mode 100644 packages/cubejs-firebolt-driver/test/test-env.js diff --git a/.github/actions/integration/firebolt.sh b/.github/actions/integration/firebolt.sh new file mode 100755 index 0000000000000..4be3b7f99ccf8 --- /dev/null +++ b/.github/actions/integration/firebolt.sh @@ -0,0 +1,10 @@ +#!/bin/bash +set -eo pipefail + +# Debug log for test containers +export DEBUG=testcontainers + +echo "::group::Firebolt [cloud]" +yarn lerna run --concurrency 1 --stream --no-prefix integration:firebolt + +echo "::endgroup::" diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index 778f2b91cff35..7c5dde94978a7 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -319,7 +319,7 @@ jobs: node-version: [20.x] db: [ 'clickhouse', 'druid', 'elasticsearch', 'mssql', 'mysql', 'postgres', 'prestodb', - 'mysql-aurora-serverless', 'crate', 'mongobi' + 'mysql-aurora-serverless', 'crate', 'mongobi', 'firebolt' ] fail-fast: false diff --git a/packages/cubejs-firebolt-driver/package.json b/packages/cubejs-firebolt-driver/package.json index 5a5311e2c6ea9..9825c2b06f09c 100644 --- a/packages/cubejs-firebolt-driver/package.json +++ b/packages/cubejs-firebolt-driver/package.json @@ -37,13 +37,14 @@ "devDependencies": { "@cubejs-backend/linter": "^1.0.0", "@cubejs-backend/testing-shared": "1.1.7", + "jest-environment-node": "^27.5.1", "typescript": "~5.2.2" }, "publishConfig": { "access": "public" }, "jest": { - "testEnvironment": "node" + "testEnvironment": "./test/test-env.js" }, "eslintConfig": { "extends": "../cubejs-linter" diff --git a/packages/cubejs-firebolt-driver/test/Firebolt.test.ts b/packages/cubejs-firebolt-driver/test/FireboltDriver.test.ts similarity index 100% rename from packages/cubejs-firebolt-driver/test/Firebolt.test.ts rename to packages/cubejs-firebolt-driver/test/FireboltDriver.test.ts diff --git a/packages/cubejs-firebolt-driver/test/test-env.js b/packages/cubejs-firebolt-driver/test/test-env.js new file mode 100644 index 0000000000000..d837613d0b93d --- /dev/null +++ b/packages/cubejs-firebolt-driver/test/test-env.js @@ -0,0 +1,23 @@ +const NodeEnvironment = require('jest-environment-node'); + +const REQUIRED_ENV_VARS = [ + 'CUBEJS_DB_USER', + 'CUBEJS_DB_PASS', + 'CUBEJS_DB_NAME', + 'CUBEJS_FIREBOLT_ENGINE_NAME', + 'CUBEJS_FIREBOLT_ACCOUNT', +]; + +class CustomEnvironment extends NodeEnvironment { + async setup() { + REQUIRED_ENV_VARS.forEach((key) => { + // Trying to populate from DRIVERS_TESTS_* vars + if (process.env[`DRIVERS_TESTS_FIREBOLT_${key}`] !== undefined) { + this.global.process.env[key] = process.env[`DRIVERS_TESTS_FIREBOLT_${key}`]; + } + }); + await super.setup(); + } +} + +module.exports = CustomEnvironment; diff --git a/yarn.lock b/yarn.lock index a3b76c1851873..a76a2850e32e8 100644 --- a/yarn.lock +++ b/yarn.lock @@ -27222,7 +27222,7 @@ string-length@^5.0.1: char-regex "^2.0.0" strip-ansi "^7.0.1" -"string-width-cjs@npm:string-width@^4.2.0", "string-width@^1.0.2 || 2 || 3 || 4", string-width@^4.0.0, string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.2, string-width@^4.2.3: +"string-width-cjs@npm:string-width@^4.2.0": version "4.2.3" resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== @@ -27240,6 +27240,15 @@ string-width@^1.0.1: is-fullwidth-code-point "^1.0.0" strip-ansi "^3.0.0" +"string-width@^1.0.2 || 2 || 3 || 4", string-width@^4.0.0, string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.2, string-width@^4.2.3: + version "4.2.3" + resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" + integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== + dependencies: + emoji-regex "^8.0.0" + is-fullwidth-code-point "^3.0.0" + strip-ansi "^6.0.1" + string-width@^2.1.1: version "2.1.1" resolved "https://registry.yarnpkg.com/string-width/-/string-width-2.1.1.tgz#ab93f27a8dc13d28cac815c462143a6d9012ae9e" @@ -27338,7 +27347,7 @@ string_decoder@~1.1.1: dependencies: safe-buffer "~5.1.0" -"strip-ansi-cjs@npm:strip-ansi@^6.0.1", strip-ansi@^6.0.0, strip-ansi@^6.0.1: +"strip-ansi-cjs@npm:strip-ansi@^6.0.1": version "6.0.1" resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== @@ -27366,6 +27375,13 @@ strip-ansi@^5.0.0, strip-ansi@^5.1.0, strip-ansi@^5.2.0: dependencies: ansi-regex "^4.1.0" +strip-ansi@^6.0.0, strip-ansi@^6.0.1: + version "6.0.1" + resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" + integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== + dependencies: + ansi-regex "^5.0.1" + strip-ansi@^7.0.1: version "7.1.0" resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-7.1.0.tgz#d5b6568ca689d8561370b0707685d22434faff45" @@ -29682,7 +29698,7 @@ wordwrap@^1.0.0: resolved "https://registry.yarnpkg.com/wordwrap/-/wordwrap-1.0.0.tgz#27584810891456a4171c8d0226441ade90cbcaeb" integrity sha1-J1hIEIkUVqQXHI0CJkQa3pDLyus= -"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0", wrap-ansi@^7.0.0: +"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0": version "7.0.0" resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43" integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q== @@ -29717,6 +29733,15 @@ wrap-ansi@^6.2.0: string-width "^4.1.0" strip-ansi "^6.0.0" +wrap-ansi@^7.0.0: + version "7.0.0" + resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43" + integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q== + dependencies: + ansi-styles "^4.0.0" + string-width "^4.1.0" + strip-ansi "^6.0.0" + wrap-ansi@^8.1.0: version "8.1.0" resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-8.1.0.tgz#56dc22368ee570face1b49819975d9b9a5ead214"