From 79d1b22caeb6bf47974fb588f1bdf2d5de9d101a Mon Sep 17 00:00:00 2001 From: Sam Rose Date: Mon, 25 Mar 2024 11:00:13 +0000 Subject: [PATCH 1/5] Pull images separately from tests, enable testcontainers debug logs. --- .github/workflows/budibase_ci.yml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/.github/workflows/budibase_ci.yml b/.github/workflows/budibase_ci.yml index 5c474aa826..c2a4fcb176 100644 --- a/.github/workflows/budibase_ci.yml +++ b/.github/workflows/budibase_ci.yml @@ -138,6 +138,8 @@ jobs: test-server: runs-on: ubuntu-latest + env: + DEBUG: testcontainers,testcontainers:exec,testcontainers:build,testcontainers:pull steps: - name: Checkout repo uses: actions/checkout@v4 @@ -151,7 +153,17 @@ jobs: with: node-version: 20.x cache: yarn + + - name: Pull testcontainers images + run: | + docker pull mcr.microsoft.com/mssql/server:2022-latest + docker pull mysql:8.3 + docker pull postgres:16.1-bullseye + docker pull mongo:7.0-jammy + docker pull mariadb:lts + - run: yarn --frozen-lockfile + - name: Test server run: | if ${{ env.USE_NX_AFFECTED }}; then From 077ca2d12089a56efe5ff6963705c23de3a1b7cc Mon Sep 17 00:00:00 2001 From: Sam Rose Date: Mon, 25 Mar 2024 11:16:37 +0000 Subject: [PATCH 2/5] Make a change in packages/server to trigger the tests. --- packages/server/src/integrations/tests/utils/mssql.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/server/src/integrations/tests/utils/mssql.ts b/packages/server/src/integrations/tests/utils/mssql.ts index 6bd4290a90..cff6809c0a 100644 --- a/packages/server/src/integrations/tests/utils/mssql.ts +++ b/packages/server/src/integrations/tests/utils/mssql.ts @@ -1,6 +1,8 @@ import { Datasource, SourceName } from "@budibase/types" import { GenericContainer, Wait, StartedTestContainer } from "testcontainers" +// TODO: remove this comment + let container: StartedTestContainer | undefined export async function start(): Promise { From 44b448f3e13412953c11ddd8edc65948dcb47fa8 Mon Sep 17 00:00:00 2001 From: Sam Rose Date: Mon, 25 Mar 2024 11:52:01 +0000 Subject: [PATCH 3/5] Also pull couchdb --- .github/workflows/budibase_ci.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/budibase_ci.yml b/.github/workflows/budibase_ci.yml index c2a4fcb176..94a001ba96 100644 --- a/.github/workflows/budibase_ci.yml +++ b/.github/workflows/budibase_ci.yml @@ -161,6 +161,8 @@ jobs: docker pull postgres:16.1-bullseye docker pull mongo:7.0-jammy docker pull mariadb:lts + docker pull testcontainers/ryuk:0.3.0 + docker pull budibase/couchdb - run: yarn --frozen-lockfile From fc41d16d1d67a2e25c1dfbeb3246d559155c5808 Mon Sep 17 00:00:00 2001 From: Sam Rose Date: Mon, 25 Mar 2024 11:52:18 +0000 Subject: [PATCH 4/5] Remove comment added to trigger tests. --- packages/server/src/integrations/tests/utils/mssql.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/packages/server/src/integrations/tests/utils/mssql.ts b/packages/server/src/integrations/tests/utils/mssql.ts index cff6809c0a..6bd4290a90 100644 --- a/packages/server/src/integrations/tests/utils/mssql.ts +++ b/packages/server/src/integrations/tests/utils/mssql.ts @@ -1,8 +1,6 @@ import { Datasource, SourceName } from "@budibase/types" import { GenericContainer, Wait, StartedTestContainer } from "testcontainers" -// TODO: remove this comment - let container: StartedTestContainer | undefined export async function start(): Promise { From 538f3b9dbe595bb246b51aca80bd83850e972e57 Mon Sep 17 00:00:00 2001 From: Sam Rose Date: Mon, 25 Mar 2024 13:51:27 +0000 Subject: [PATCH 5/5] Align our use of images across the codebase. --- packages/server/src/sdk/app/rows/search/tests/external.spec.ts | 2 +- .../src/integrations/external-schema/mysql.integration.spec.ts | 2 +- .../integrations/external-schema/postgres.integration.spec.ts | 2 +- qa-core/src/integrations/validators/mongo.integration.spec.ts | 2 +- qa-core/src/integrations/validators/mssql.integration.spec.ts | 2 +- qa-core/src/integrations/validators/mysql.integration.spec.ts | 2 +- .../src/integrations/validators/postgres.integration.spec.ts | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/packages/server/src/sdk/app/rows/search/tests/external.spec.ts b/packages/server/src/sdk/app/rows/search/tests/external.spec.ts index 8ecec784dd..bae58d6a2c 100644 --- a/packages/server/src/sdk/app/rows/search/tests/external.spec.ts +++ b/packages/server/src/sdk/app/rows/search/tests/external.spec.ts @@ -26,7 +26,7 @@ describe("external search", () => { const rows: Row[] = [] beforeAll(async () => { - const container = await new GenericContainer("mysql") + const container = await new GenericContainer("mysql:8.3") .withExposedPorts(3306) .withEnvironment({ MYSQL_ROOT_PASSWORD: "admin", diff --git a/qa-core/src/integrations/external-schema/mysql.integration.spec.ts b/qa-core/src/integrations/external-schema/mysql.integration.spec.ts index 5a7e1989d2..c8d285a021 100644 --- a/qa-core/src/integrations/external-schema/mysql.integration.spec.ts +++ b/qa-core/src/integrations/external-schema/mysql.integration.spec.ts @@ -6,7 +6,7 @@ describe("datasource validators", () => { let config: any beforeAll(async () => { - const container = await new GenericContainer("mysql") + const container = await new GenericContainer("mysql:8.3") .withExposedPorts(3306) .withEnv("MYSQL_ROOT_PASSWORD", "admin") .withEnv("MYSQL_DATABASE", "db") diff --git a/qa-core/src/integrations/external-schema/postgres.integration.spec.ts b/qa-core/src/integrations/external-schema/postgres.integration.spec.ts index a0812c9677..7581d7f88a 100644 --- a/qa-core/src/integrations/external-schema/postgres.integration.spec.ts +++ b/qa-core/src/integrations/external-schema/postgres.integration.spec.ts @@ -17,7 +17,7 @@ describe("getExternalSchema", () => { } beforeAll(async () => { - const container = await new GenericContainer("postgres:13.12") + const container = await new GenericContainer("postgres:16.1-bullseye") .withExposedPorts(5432) .withEnv("POSTGRES_PASSWORD", "password") .start() diff --git a/qa-core/src/integrations/validators/mongo.integration.spec.ts b/qa-core/src/integrations/validators/mongo.integration.spec.ts index 9132d79f74..b1bab3bd1f 100644 --- a/qa-core/src/integrations/validators/mongo.integration.spec.ts +++ b/qa-core/src/integrations/validators/mongo.integration.spec.ts @@ -26,7 +26,7 @@ describe("datasource validators", () => { beforeAll(async () => { const user = generator.name() const password = generator.hash() - const container = await new GenericContainer("mongo") + const container = await new GenericContainer("mongo:7.0-jammy") .withExposedPorts(27017) .withEnv("MONGO_INITDB_ROOT_USERNAME", user) .withEnv("MONGO_INITDB_ROOT_PASSWORD", password) diff --git a/qa-core/src/integrations/validators/mssql.integration.spec.ts b/qa-core/src/integrations/validators/mssql.integration.spec.ts index d8f36e8bd0..c07f1d1129 100644 --- a/qa-core/src/integrations/validators/mssql.integration.spec.ts +++ b/qa-core/src/integrations/validators/mssql.integration.spec.ts @@ -13,7 +13,7 @@ describe("datasource validators", () => { beforeAll(async () => { const container = await new GenericContainer( - "mcr.microsoft.com/mssql/server" + "mcr.microsoft.com/mssql/server:2022-latest" ) .withExposedPorts(1433) .withEnv("ACCEPT_EULA", "Y") diff --git a/qa-core/src/integrations/validators/mysql.integration.spec.ts b/qa-core/src/integrations/validators/mysql.integration.spec.ts index e828d192af..95f7d4abbd 100644 --- a/qa-core/src/integrations/validators/mysql.integration.spec.ts +++ b/qa-core/src/integrations/validators/mysql.integration.spec.ts @@ -7,7 +7,7 @@ describe("datasource validators", () => { let port: number beforeAll(async () => { - const container = await new GenericContainer("mysql") + const container = await new GenericContainer("mysql:8.3") .withExposedPorts(3306) .withEnv("MYSQL_ROOT_PASSWORD", "admin") .withEnv("MYSQL_DATABASE", "db") diff --git a/qa-core/src/integrations/validators/postgres.integration.spec.ts b/qa-core/src/integrations/validators/postgres.integration.spec.ts index 5101cf1d2d..9e3e1ab30f 100644 --- a/qa-core/src/integrations/validators/postgres.integration.spec.ts +++ b/qa-core/src/integrations/validators/postgres.integration.spec.ts @@ -9,7 +9,7 @@ describe("datasource validators", () => { let port: number beforeAll(async () => { - const container = await new GenericContainer("postgres") + const container = await new GenericContainer("postgres:16.1-bullseye") .withExposedPorts(5432) .withEnv("POSTGRES_PASSWORD", "password") .start()