diff --git a/packages/server/src/integrations/tests/utils/images.ts b/packages/server/src/integrations/tests/utils/images.ts index 4141b9b059..8c2bb9b220 100644 --- a/packages/server/src/integrations/tests/utils/images.ts +++ b/packages/server/src/integrations/tests/utils/images.ts @@ -6,12 +6,8 @@ dotenv.config({ path, }) -export function getImageSHAs() { - return { - mssql: `mcr.microsoft.com/mssql/server@${process.env.MSSQL_SHA}`, - mysql: `mysql@${process.env.MYSQL_SHA}`, - postgres: `postgres@${process.env.POSTGRES_SHA}`, - mongodb: `mongo@${process.env.MONGODB_SHA}`, - mariadb: `mariadb@${process.env.MARIADB_SHA}`, - } -} +export const MSSQL_IMAGE = `mcr.microsoft.com/mssql/server@${process.env.MSSQL_SHA}` +export const MYSQL_IMAGE = `mysql@${process.env.MYSQL_SHA}` +export const POSTGRES_IMAGE = `postgres@${process.env.POSTGRES_SHA}` +export const MONGODB_IMAGE = `mongo@${process.env.MONGODB_SHA}` +export const MARIADB_IMAGE = `mariadb@${process.env.MARIADB_SHA}` diff --git a/packages/server/src/integrations/tests/utils/mariadb.ts b/packages/server/src/integrations/tests/utils/mariadb.ts index 004b79e60f..529ac0b76b 100644 --- a/packages/server/src/integrations/tests/utils/mariadb.ts +++ b/packages/server/src/integrations/tests/utils/mariadb.ts @@ -4,7 +4,7 @@ import { AbstractWaitStrategy } from "testcontainers/build/wait-strategies/wait- import { generator, testContainerUtils } from "@budibase/backend-core/tests" import { startContainer } from "." import { knexClient } from "./mysql" -import { getImageSHAs } from "./images" +import { MARIADB_IMAGE } from "./images" let ports: Promise @@ -28,7 +28,7 @@ class MariaDBWaitStrategy extends AbstractWaitStrategy { export async function getDatasource(): Promise { if (!ports) { ports = startContainer( - new GenericContainer(getImageSHAs().mariadb) + new GenericContainer(MARIADB_IMAGE) .withExposedPorts(3306) .withEnvironment({ MARIADB_ROOT_PASSWORD: "password" }) .withWaitStrategy(new MariaDBWaitStrategy()) diff --git a/packages/server/src/integrations/tests/utils/mongodb.ts b/packages/server/src/integrations/tests/utils/mongodb.ts index 08cbf81b17..a62d895042 100644 --- a/packages/server/src/integrations/tests/utils/mongodb.ts +++ b/packages/server/src/integrations/tests/utils/mongodb.ts @@ -2,14 +2,14 @@ import { generator, testContainerUtils } from "@budibase/backend-core/tests" import { Datasource, SourceName } from "@budibase/types" import { GenericContainer, Wait } from "testcontainers" import { startContainer } from "." -import { getImageSHAs } from "./images" +import { MONGODB_IMAGE } from "./images" let ports: Promise export async function getDatasource(): Promise { if (!ports) { ports = startContainer( - new GenericContainer(getImageSHAs().mongodb) + new GenericContainer(MONGODB_IMAGE) .withExposedPorts(27017) .withEnvironment({ MONGO_INITDB_ROOT_USERNAME: "mongo", diff --git a/packages/server/src/integrations/tests/utils/mssql.ts b/packages/server/src/integrations/tests/utils/mssql.ts index e3a49f6cec..709ebb9439 100644 --- a/packages/server/src/integrations/tests/utils/mssql.ts +++ b/packages/server/src/integrations/tests/utils/mssql.ts @@ -3,14 +3,14 @@ import { GenericContainer, Wait } from "testcontainers" import { generator, testContainerUtils } from "@budibase/backend-core/tests" import { startContainer } from "." import knex from "knex" -import { getImageSHAs } from "./images" +import { MSSQL_IMAGE } from "./images" let ports: Promise export async function getDatasource(): Promise { if (!ports) { ports = startContainer( - new GenericContainer(getImageSHAs().mssql) + new GenericContainer(MSSQL_IMAGE) .withExposedPorts(1433) .withEnvironment({ ACCEPT_EULA: "Y", diff --git a/packages/server/src/integrations/tests/utils/mysql.ts b/packages/server/src/integrations/tests/utils/mysql.ts index f26a751d1e..68e591837b 100644 --- a/packages/server/src/integrations/tests/utils/mysql.ts +++ b/packages/server/src/integrations/tests/utils/mysql.ts @@ -4,7 +4,7 @@ import { AbstractWaitStrategy } from "testcontainers/build/wait-strategies/wait- import { generator, testContainerUtils } from "@budibase/backend-core/tests" import { startContainer } from "." import knex from "knex" -import { getImageSHAs } from "./images" +import { MYSQL_IMAGE } from "./images" let ports: Promise @@ -31,7 +31,7 @@ class MySQLWaitStrategy extends AbstractWaitStrategy { export async function getDatasource(): Promise { if (!ports) { ports = startContainer( - new GenericContainer(getImageSHAs().mysql) + new GenericContainer(MYSQL_IMAGE) .withExposedPorts(3306) .withEnvironment({ MYSQL_ROOT_PASSWORD: "password" }) .withWaitStrategy(new MySQLWaitStrategy().withStartupTimeout(10000)) diff --git a/packages/server/src/integrations/tests/utils/postgres.ts b/packages/server/src/integrations/tests/utils/postgres.ts index d7639ce7c7..bf8d76e39d 100644 --- a/packages/server/src/integrations/tests/utils/postgres.ts +++ b/packages/server/src/integrations/tests/utils/postgres.ts @@ -3,14 +3,14 @@ import { GenericContainer, Wait } from "testcontainers" import { generator, testContainerUtils } from "@budibase/backend-core/tests" import { startContainer } from "." import knex from "knex" -import { getImageSHAs } from "./images" +import { POSTGRES_IMAGE } from "./images" let ports: Promise export async function getDatasource(): Promise { if (!ports) { ports = startContainer( - new GenericContainer(getImageSHAs().postgres) + new GenericContainer(POSTGRES_IMAGE) .withExposedPorts(5432) .withEnvironment({ POSTGRES_PASSWORD: "password" }) .withWaitStrategy(