diff --git a/ci/.env.ci b/ci/.env.ci index 0d1de4b..9ac82b6 100644 --- a/ci/.env.ci +++ b/ci/.env.ci @@ -1,5 +1,11 @@ # PRISMA DATABASE_URL="postgresql://user:user@v3-user-db-test:5432/user?schema=public" +# RABBIT MQ +RMQ_URI=amqp://v3-broker:5672 + +# MESSAGE BROKER +BROKER_IMAGE=rabbitmq:3-alpine + # POSTGRES POSTGRES_IMAGE=postgres:15.0 diff --git a/ci/Dockerfile b/ci/Dockerfile index 0f39199..f3d2149 100644 --- a/ci/Dockerfile +++ b/ci/Dockerfile @@ -1,5 +1,5 @@ ################### -# BUILD FOR LOCAL DEVELOPMENT +# BUILD FOR CI TESTING ################### FROM node:18-alpine3.16 @@ -19,5 +19,8 @@ COPY . . # Creates a "dist" folder RUN npm run build -# Execute test suite +# Execute unit tests RUN npm run test:unit + +# Start the server using the production build +CMD [ "node", "dist/main.js" ] diff --git a/docker-compose.ci.yml b/docker-compose.ci.yml index fe808ce..9335edf 100644 --- a/docker-compose.ci.yml +++ b/docker-compose.ci.yml @@ -12,6 +12,7 @@ services: - 5001:5001 depends_on: - db-test + - broker networks: v3-network: aliases: @@ -31,6 +32,16 @@ services: aliases: - v3-user-db-test + broker: + container_name: v3-broker + image: ${BROKER_IMAGE} + ports: + - 5672:5672 + networks: + v3-network: + aliases: + - v3-broker + networks: v3-network: name: v3-network diff --git a/src/modules/users/users.module.ts b/src/modules/users/users.module.ts index 1192751..ac44fea 100644 --- a/src/modules/users/users.module.ts +++ b/src/modules/users/users.module.ts @@ -32,6 +32,7 @@ import { UserProfile } from './mappers/user.profile'; }, ], uri: configService.get('RMQ_URI'), + connectionInitOptions: { wait: false }, }), inject: [ConfigService], }),