Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 0 additions & 19 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,25 +9,6 @@ services:
- rabbit_data:/var/lib/rabbitmq
restart: on-failure

localstack:
image: localstack/localstack:4.10.0
network_mode: bridge
hostname: localstack
ports:
- '127.0.0.1:4566:4566' # LocalStack Gateway
- '127.0.0.1:4510-4559:4510-4559' # external services port range
environment:
- SERVICES=sns,sqs,s3,sts
- DEBUG=0
- DATA_DIR=${DATA_DIR-}
- DOCKER_HOST=unix:///var/run/docker.sock
- LOCALSTACK_HOST=localstack
# - LOCALSTACK_API_KEY=someDummyKey
volumes:
- '${TMPDIR:-/tmp}/localstack:/var/log/localstack'
- '/var/run/docker.sock:/var/run/docker.sock'
restart: on-failure

redis:
image: redis:6.2.7-alpine
command: redis-server --requirepass sOmE_sEcUrE_pAsS
Expand Down
3 changes: 1 addition & 2 deletions packages/s3-payload-store/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@
"test:coverage": "npm run test -- --coverage",
"lint": "biome check . && tsc",
"lint:fix": "biome check --write .",
"docker:start": "docker compose up -d --quiet-pull localstack",
"docker:stop": "docker compose down",
"prepublishOnly": "npm run lint && npm run build"
},
"dependencies": {},
Expand All @@ -43,6 +41,7 @@
"@lokalise/tsconfig": "^3.0.0",
"@types/node": "^25.0.2",
"@vitest/coverage-v8": "^4.0.15",
"fauxqs": "^1.2.0",
"rimraf": "^6.0.1",
"typescript": "^5.9.2",
"vitest": "^4.0.15"
Expand Down
11 changes: 11 additions & 0 deletions packages/s3-payload-store/test/utils/globalSetup.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { startFauxqs } from 'fauxqs'

let server: Awaited<ReturnType<typeof startFauxqs>>

export async function setup() {
server = await startFauxqs({ port: 4566, logger: false, host: 'localstack' })
}

export async function teardown() {
await server.stop()
}
4 changes: 3 additions & 1 deletion packages/s3-payload-store/test/utils/testS3Config.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import type { S3ClientConfig } from '@aws-sdk/client-s3'
import { createLocalhostHandler } from 'fauxqs'

export const TEST_AWS_CONFIG: S3ClientConfig = {
endpoint: 'http://s3.localhost.localstack.cloud:4566',
endpoint: 'http://s3.localhost:4566',
region: 'eu-west-1',
credentials: {
accessKeyId: 'access',
secretAccessKey: 'secret',
},
requestHandler: createLocalhostHandler(),
}
2 changes: 2 additions & 0 deletions packages/s3-payload-store/vitest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ export default defineConfig({
watch: false,
mockReset: true,
pool: 'threads',
maxWorkers: 1,
globalSetup: ['test/utils/globalSetup.ts'],
coverage: {
provider: 'v8',
include: ['lib/**/*.ts'],
Expand Down
5 changes: 3 additions & 2 deletions packages/sns/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"test:coverage": "npm run test -- --coverage",
"lint": "biome check . && tsc",
"lint:fix": "biome check --write .",
"docker:start": "docker compose up -d localstack redis",
"docker:start": "docker compose up -d redis",
"docker:stop": "docker compose down",
"prepublishOnly": "npm run lint && npm run build"
},
Expand Down Expand Up @@ -53,8 +53,9 @@
"@message-queue-toolkit/sqs": "*",
"@types/node": "^25.0.2",
"@vitest/coverage-v8": "^4.0.15",
"awilix": "^12.0.5",
"awilix": "^12.1.1",
"awilix-manager": "^6.1.0",
"fauxqs": "^1.2.0",
"ioredis": "^5.7.0",
"rimraf": "^6.0.1",
"typescript": "^5.9.3",
Expand Down
11 changes: 11 additions & 0 deletions packages/sns/test/utils/globalSetup.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { startFauxqs } from 'fauxqs'

let server: Awaited<ReturnType<typeof startFauxqs>>

export async function setup() {
server = await startFauxqs({ port: 4566, logger: false, host: 'localstack' })
}

export async function teardown() {
await server.stop()
}
4 changes: 2 additions & 2 deletions packages/sns/test/utils/testContext.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import { SnsSqsPermissionConsumer } from '../consumers/SnsSqsPermissionConsumer.
import { CreateLocateConfigMixPublisher } from '../publishers/CreateLocateConfigMixPublisher.ts'
import { SnsPermissionPublisher } from '../publishers/SnsPermissionPublisher.ts'
import { TEST_REDIS_CONFIG } from './testRedisConfig.ts'
import { TEST_AWS_CONFIG } from './testSnsConfig.ts'
import { TEST_AWS_CONFIG, TEST_S3_CONFIG } from './testSnsConfig.ts'

export const SINGLETON_CONFIG = { lifetime: Lifetime.SINGLETON }

Expand Down Expand Up @@ -109,7 +109,7 @@ export async function registerDependencies(
},
),
s3: asFunction(() => {
return new S3(TEST_AWS_CONFIG)
return new S3(TEST_S3_CONFIG)
}),

consumerErrorResolver: asClass(FakeConsumerErrorResolver, SINGLETON_CONFIG),
Expand Down
15 changes: 13 additions & 2 deletions packages/sns/test/utils/testSnsConfig.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,23 @@
import type { S3ClientConfig } from '@aws-sdk/client-s3'
import type { SNSClientConfig } from '@aws-sdk/client-sns'
import type { SQSClientConfig } from '@aws-sdk/client-sqs'
import { createLocalhostHandler } from 'fauxqs'

export const TEST_AWS_CONFIG: SNSClientConfig & SQSClientConfig & S3ClientConfig = {
endpoint: 'http://s3.localhost.localstack.cloud:4566',
export const TEST_AWS_CONFIG: SNSClientConfig & SQSClientConfig = {
endpoint: 'http://localhost:4566',
region: 'eu-west-1',
credentials: {
accessKeyId: 'access',
secretAccessKey: 'secret',
},
}

export const TEST_S3_CONFIG: S3ClientConfig = {
endpoint: 'http://s3.localhost:4566',
region: 'eu-west-1',
credentials: {
accessKeyId: 'access',
secretAccessKey: 'secret',
},
requestHandler: createLocalhostHandler(),
}
1 change: 1 addition & 0 deletions packages/sns/vitest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export default defineConfig({
mockReset: true,
pool: 'threads',
maxWorkers: 1,
globalSetup: ['test/utils/globalSetup.ts'],
coverage: {
provider: 'v8',
include: ['lib/**/*.ts'],
Expand Down
5 changes: 3 additions & 2 deletions packages/sqs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"test:coverage": "npm run test -- --coverage",
"lint": "biome check && tsc",
"lint:fix": "biome check --write .",
"docker:start": "docker compose up -d localstack redis",
"docker:start": "docker compose up -d redis",
"docker:stop": "docker compose down",
"prepublishOnly": "npm run lint && npm run build"
},
Expand All @@ -50,8 +50,9 @@
"@vitest/coverage-v8": "^4.0.15",
"awilix": "^12.0.5",
"awilix-manager": "^6.1.0",
"rimraf": "^6.0.1",
"fauxqs": "^1.2.0",
"ioredis": "^5.6.1",
"rimraf": "^6.0.1",
"typescript": "^5.9.3",
"vitest": "^4.0.15",
"zod": "^4.1.13"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ describe('SqsPermissionConsumer - deadLetterQueue', () => {
deadLetterQueue: {
redrivePolicy: { maxReceiveCount: 5 },
locatorConfig: {
queueUrl: 'http://s3.localhost.localstack.cloud:4566/000000000000/badQueue',
queueUrl: 'http://localhost:4566/000000000000/badQueue',
},
},
})
Expand Down
11 changes: 11 additions & 0 deletions packages/sqs/test/utils/globalSetup.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { startFauxqs } from 'fauxqs'

let server: Awaited<ReturnType<typeof startFauxqs>>

export async function setup() {
server = await startFauxqs({ port: 4566, logger: false, host: 'localstack' })
}

export async function teardown() {
await server.stop()
}
15 changes: 13 additions & 2 deletions packages/sqs/test/utils/testAwsConfig.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,22 @@
import type { S3ClientConfig } from '@aws-sdk/client-s3'
import type { SQSClientConfig } from '@aws-sdk/client-sqs'
import { createLocalhostHandler } from 'fauxqs'

export const TEST_AWS_CONFIG: SQSClientConfig & S3ClientConfig = {
endpoint: 'http://s3.localhost.localstack.cloud:4566',
export const TEST_AWS_CONFIG: SQSClientConfig = {
endpoint: 'http://localhost:4566',
region: 'eu-west-1',
credentials: {
accessKeyId: 'access',
secretAccessKey: 'secret',
},
}

export const TEST_S3_CONFIG: S3ClientConfig = {
endpoint: 'http://s3.localhost:4566',
region: 'eu-west-1',
credentials: {
accessKeyId: 'access',
secretAccessKey: 'secret',
},
requestHandler: createLocalhostHandler(),
}
4 changes: 2 additions & 2 deletions packages/sqs/test/utils/testContext.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { Redis } from 'ioredis'
import { SqsConsumerErrorResolver } from '../../lib/errors/SqsConsumerErrorResolver.ts'
import { SqsPermissionConsumer } from '../consumers/SqsPermissionConsumer.ts'
import { SqsPermissionPublisher } from '../publishers/SqsPermissionPublisher.ts'
import { TEST_AWS_CONFIG } from './testAwsConfig.ts'
import { TEST_AWS_CONFIG, TEST_S3_CONFIG } from './testAwsConfig.ts'
import { TEST_REDIS_CONFIG } from './testRedisConfig.ts'

export const SINGLETON_CONFIG = { lifetime: Lifetime.SINGLETON }
Expand Down Expand Up @@ -51,7 +51,7 @@ export async function registerDependencies(dependencyOverrides: DependencyOverri
},
),
s3: asFunction(() => {
return new S3(TEST_AWS_CONFIG)
return new S3(TEST_S3_CONFIG)
}),
consumerErrorResolver: asFunction(() => {
return new SqsConsumerErrorResolver()
Expand Down
1 change: 1 addition & 0 deletions packages/sqs/vitest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export default defineConfig({
mockReset: true,
pool: 'threads',
maxWorkers: 1,
globalSetup: ['test/utils/globalSetup.ts'],
coverage: {
provider: 'v8',
include: ['lib/**/*.ts'],
Expand Down
Loading