From 0e81191b5a1d91de20af8e2d738aa81bccc15ed2 Mon Sep 17 00:00:00 2001 From: Peter Clement Date: Fri, 15 Mar 2024 16:03:34 +0000 Subject: [PATCH] use minio image instead of s3 for testing --- packages/server/src/integrations/tests/rest.spec.ts | 6 +++--- packages/server/src/integrations/tests/utils/index.ts | 6 ++++-- .../server/src/integrations/tests/utils/{s3.ts => minio.ts} | 5 ++--- 3 files changed, 9 insertions(+), 8 deletions(-) rename packages/server/src/integrations/tests/utils/{s3.ts => minio.ts} (82%) diff --git a/packages/server/src/integrations/tests/rest.spec.ts b/packages/server/src/integrations/tests/rest.spec.ts index 978289fbf2..54ca87815f 100644 --- a/packages/server/src/integrations/tests/rest.spec.ts +++ b/packages/server/src/integrations/tests/rest.spec.ts @@ -28,7 +28,7 @@ jest.mock("uuid", () => ({ v4: () => "00000000-0000-0000-0000-000000000000" })) import { default as RestIntegration } from "../rest" import { RestAuthType } from "@budibase/types" import fetch from "node-fetch" -import { databaseTestProviders } from "./utils" +import { objectStoreTestProviders } from "./utils" const FormData = require("form-data") const { URLSearchParams } = require("url") @@ -627,11 +627,11 @@ describe("REST Integration", () => { describe("File Handling", () => { beforeAll(async () => { - await databaseTestProviders.s3.start() + await objectStoreTestProviders.minio.start() }) afterAll(async () => { - await databaseTestProviders.s3.stop() + await objectStoreTestProviders.minio.stop() }) it("uploads file to object store and returns signed URL", async () => { diff --git a/packages/server/src/integrations/tests/utils/index.ts b/packages/server/src/integrations/tests/utils/index.ts index cd749d2cba..9d82a3392c 100644 --- a/packages/server/src/integrations/tests/utils/index.ts +++ b/packages/server/src/integrations/tests/utils/index.ts @@ -4,7 +4,7 @@ import { Datasource } from "@budibase/types" import * as postgres from "./postgres" import * as mongodb from "./mongodb" import * as mysql from "./mysql" -import * as s3 from "./s3" +import * as minio from "./minio" import { StartedTestContainer } from "testcontainers" jest.setTimeout(30000) @@ -15,4 +15,6 @@ export interface DatabaseProvider { datasource(): Promise } -export const databaseTestProviders = { postgres, mongodb, mysql, s3 } +export const databaseTestProviders = { postgres, mongodb, mysql } + +export const objectStoreTestProviders = { minio } diff --git a/packages/server/src/integrations/tests/utils/s3.ts b/packages/server/src/integrations/tests/utils/minio.ts similarity index 82% rename from packages/server/src/integrations/tests/utils/s3.ts rename to packages/server/src/integrations/tests/utils/minio.ts index c6ab25ee9c..006f0d1553 100644 --- a/packages/server/src/integrations/tests/utils/s3.ts +++ b/packages/server/src/integrations/tests/utils/minio.ts @@ -1,10 +1,9 @@ -import { Datasource } from "@budibase/types" import { GenericContainer, Wait, StartedTestContainer } from "testcontainers" import { AbstractWaitStrategy } from "testcontainers/build/wait-strategies/wait-strategy" let container: StartedTestContainer | undefined -class MinioWaitStrategy extends AbstractWaitStrategy { +class ObjectStoreWaitStrategy extends AbstractWaitStrategy { async waitUntilReady(container: any, boundPorts: any, startTime?: Date) { const logs = Wait.forListeningPorts() await logs.waitUntilReady(container, boundPorts, startTime) @@ -19,7 +18,7 @@ export async function start(): Promise { MINIO_ACCESS_KEY: "budibase", MINIO_SECRET_KEY: "budibase", }) - .withWaitStrategy(new MinioWaitStrategy().withStartupTimeout(30000)) + .withWaitStrategy(new ObjectStoreWaitStrategy().withStartupTimeout(30000)) .start() return container