From 6f0cd3f3b08c20208cf969f04e119e24c3937e5b Mon Sep 17 00:00:00 2001 From: Schnitz <12687466+CptSchnitz@users.noreply.github.com> Date: Thu, 17 Sep 2026 07:48:16 +0300 Subject: [PATCH 1/3] test(global): changed from minio to seaweedfs --- .../configurations/vitest.globalSetup.mts | 14 +++------- packages/test-utils/package.json | 2 +- packages/test-utils/src/containers.ts | 26 +++++++++++++------ pnpm-lock.yaml | 19 +++----------- 4 files changed, 26 insertions(+), 35 deletions(-) diff --git a/apps/auth-cron/tests/configurations/vitest.globalSetup.mts b/apps/auth-cron/tests/configurations/vitest.globalSetup.mts index 237574ce..9e374ed5 100644 --- a/apps/auth-cron/tests/configurations/vitest.globalSetup.mts +++ b/apps/auth-cron/tests/configurations/vitest.globalSetup.mts @@ -1,14 +1,6 @@ import path from 'node:path'; import type { TestProject } from 'vitest/node'; -import { - createMinioContainer, - MINIO_PORT, - createS3Client, - createAndProvideTempDir, - removeTempDir, - mergeTestConfig, - ensureBucketExists, -} from 'test-utils'; +import { createS3Container, S3_PORT, createS3Client, createAndProvideTempDir, removeTempDir, mergeTestConfig, ensureBucketExists } from 'test-utils'; import { getConfig, initConfig } from '@src/config.js'; export async function setup(project: TestProject): Promise { @@ -17,12 +9,12 @@ export async function setup(project: TestProject): Promise { const configInstance = getConfig(); const cronOptions = configInstance.get('cron.np'); - const container = await createMinioContainer({ + const container = await createS3Container({ username: cronOptions?.s3.accessKeyId as string, password: cronOptions?.s3.secretAccessKey as string, }); - const endpoint = `http://${container.getHost()}:${container.getMappedPort(MINIO_PORT)}`; + const endpoint = `http://${container.getHost()}:${container.getMappedPort(S3_PORT)}`; await mergeTestConfig(path.join(__dirname, '../../config'), { 'cron.np.s3.endpoint': endpoint, 'cron.prod.s3.endpoint': endpoint }); diff --git a/packages/test-utils/package.json b/packages/test-utils/package.json index e4e5cfe5..d9f79499 100644 --- a/packages/test-utils/package.json +++ b/packages/test-utils/package.json @@ -35,8 +35,8 @@ "@faker-js/faker": "catalog:", "@map-colonies/auth-core": "workspace:^", "@map-colonies/schemas": "catalog:", - "@testcontainers/minio": "~11.14.0", "@testcontainers/postgresql": "^11.14.0", + "testcontainers": "^11.14.0", "lodash": "catalog:", "drizzle-orm": "catalog:", "pg": "catalog:" diff --git a/packages/test-utils/src/containers.ts b/packages/test-utils/src/containers.ts index 4e191f85..11b5f525 100644 --- a/packages/test-utils/src/containers.ts +++ b/packages/test-utils/src/containers.ts @@ -1,8 +1,9 @@ import { PostgreSqlContainer, type StartedPostgreSqlContainer } from '@testcontainers/postgresql'; -import { MinioContainer, type StartedMinioContainer } from '@testcontainers/minio'; +// import { MinioContainer, type StartedMinioContainer, } from '@testcontainers/minio'; +import { GenericContainer, Wait, type StartedTestContainer } from 'testcontainers'; const POSTGRES_IMAGE = 'postgres:15'; -const MINIO_IMAGE = 'minio/minio:latest'; +const SEAWEEDFS_IMAGE = 'chrislusf/seaweedfs:4.47'; export const PG_PORT = 5432; @@ -20,14 +21,23 @@ export async function createPostgresContainer(options: { return container.withUsername(options.username).withDatabase(options.database).withPassword(options.password).start(); } -export const MINIO_PORT = 9000; - -export async function createMinioContainer(options: { username: string; password: string }): Promise { - const container = new MinioContainer(MINIO_IMAGE); +export const S3_PORT = 8333; +export const S3_UI_PORT = 8888; + +export async function createS3Container(options: { username: string; password: string }): Promise { + const container = new GenericContainer(SEAWEEDFS_IMAGE) + .withExposedPorts(S3_PORT, S3_UI_PORT) + .withEnvironment({ + /* eslint-disable @typescript-eslint/naming-convention */ + AWS_ACCESS_KEY_ID: options.username, + AWS_SECRET_ACCESS_KEY: options.password, + S3_BUCKET: 'test-bucket', + /* eslint-enable @typescript-eslint/naming-convention */ + }) + .withWaitStrategy(Wait.forLogMessage('/.*All enabled components are running and ready to use.*/')); if (process.env.CI === undefined) { container.withReuse(); } - - return container.withUsername(options.username).withPassword(options.password).start(); + return container.start(); } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index c8c7713b..0e023885 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -1053,9 +1053,6 @@ importers: '@map-colonies/schemas': specifier: 'catalog:' version: 1.21.0 - '@testcontainers/minio': - specifier: ~11.14.0 - version: 11.14.0 '@testcontainers/postgresql': specifier: ^11.14.0 version: 11.14.0 @@ -1068,6 +1065,9 @@ importers: pg: specifier: 'catalog:' version: 8.20.0 + testcontainers: + specifier: ^11.14.0 + version: 11.14.0 vitest: specifier: 'catalog:' version: 4.1.4(@opentelemetry/api@1.9.0)(@types/node@24.12.0)(@vitest/coverage-v8@4.1.4)(@vitest/ui@4.1.4)(vite@7.3.1(@types/node@24.12.0)(jiti@2.6.1)(lightningcss@1.32.0)(tsx@4.21.0)(yaml@2.8.3)) @@ -4341,9 +4341,6 @@ packages: resolution: {integrity: sha512-ldZXEhOBb8Is7xLs01fR3YEc3DERiz5silj8tnGkFZytt1abEvl/GhUmCE0PMLaMPTa3Jk4HbKmRlHmu+gCftg==} engines: {node: '>=12'} - '@testcontainers/minio@11.14.0': - resolution: {integrity: sha512-IhoKiUTEHncJMwVHxy1vGK8XDp/wy4uodU1D45zNCBGvTURGp3mgXsDhVaBiVniEEfofyuqKp1HFauDxqDdzBQ==} - '@testcontainers/postgresql@11.14.0': resolution: {integrity: sha512-wYbJn8GRTj8qfqzfVubxioYWlHJU/ImIjuzPwyy9C5Qfo6g3GLduPZAj+BifvqTZjgT3gd4gFVLCPhBji7dc1w==} @@ -9213,6 +9210,7 @@ packages: uuid@10.0.0: resolution: {integrity: sha512-8XkAphELsDnEGrDxUOHB3RGvXz6TeuYSGEZBOjtTtPm2lwhGBjLgOzLHB63IUWfBpNucQjND6d3AOudO+H3RWQ==} + deprecated: uuid@10 and below is no longer supported. For ESM codebases, update to uuid@latest. For CommonJS codebases, use uuid@11 (but be aware this version will likely be deprecated in 2028). hasBin: true uuid@8.3.2: @@ -13352,15 +13350,6 @@ snapshots: '@tanstack/table-core@8.21.3': {} - '@testcontainers/minio@11.14.0': - dependencies: - testcontainers: 11.14.0 - transitivePeerDependencies: - - bare-abort-controller - - bare-buffer - - react-native-b4a - - supports-color - '@testcontainers/postgresql@11.14.0': dependencies: testcontainers: 11.14.0 From 2fff17b158b0cfeb03729276c14cfc2c46b47752 Mon Sep 17 00:00:00 2001 From: Schnitz <12687466+CptSchnitz@users.noreply.github.com> Date: Thu, 17 Sep 2026 07:58:35 +0300 Subject: [PATCH 2/3] test(test-utils): changed wait strategy --- packages/test-utils/src/containers.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/test-utils/src/containers.ts b/packages/test-utils/src/containers.ts index 11b5f525..8dc38fff 100644 --- a/packages/test-utils/src/containers.ts +++ b/packages/test-utils/src/containers.ts @@ -34,7 +34,7 @@ export async function createS3Container(options: { username: string; password: s S3_BUCKET: 'test-bucket', /* eslint-enable @typescript-eslint/naming-convention */ }) - .withWaitStrategy(Wait.forLogMessage('/.*All enabled components are running and ready to use.*/')); + .withWaitStrategy(Wait.forListeningPorts()); if (process.env.CI === undefined) { container.withReuse(); From ba034caf7da9f0850a4980a5c7325db5a1285270 Mon Sep 17 00:00:00 2001 From: Schnitz <12687466+CptSchnitz@users.noreply.github.com> Date: Thu, 17 Sep 2026 13:48:37 +0300 Subject: [PATCH 3/3] chore(test-utils): remove comment --- packages/test-utils/src/containers.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/test-utils/src/containers.ts b/packages/test-utils/src/containers.ts index 8dc38fff..b4679054 100644 --- a/packages/test-utils/src/containers.ts +++ b/packages/test-utils/src/containers.ts @@ -1,5 +1,4 @@ import { PostgreSqlContainer, type StartedPostgreSqlContainer } from '@testcontainers/postgresql'; -// import { MinioContainer, type StartedMinioContainer, } from '@testcontainers/minio'; import { GenericContainer, Wait, type StartedTestContainer } from 'testcontainers'; const POSTGRES_IMAGE = 'postgres:15';