test ci --check

This commit is contained in:
Gsk54 2023-01-10 10:39:36 +01:00
parent 35c8e1c065
commit df6c3d765d
3 changed files with 36 additions and 19 deletions

View File

@ -8,7 +8,7 @@ stages:
# TEST STAGE #
##############
unit-test-api:
unit-test:
stage: test:unit
image: node:18-alpine3.16
script:
@ -18,6 +18,22 @@ unit-test-api:
- if: '$CI_MERGE_REQUEST_TARGET_BRANCH_NAME == $CI_DEFAULT_BRANCH || $CI_COMMIT_MESSAGE =~ /--check/ || $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH'
when: always
integration-test:
stage: test:integration
image: docker/compose:latest
variables:
DOCKER_TLS_CERTDIR: ""
services:
- docker:dind
script:
- docker-compose -f docker-compose.ci.yml --env-file ci/.env.ci up -d
- sleep 30
- npm install
- npm run test:integration
rules:
- if: '$CI_MERGE_REQUEST_TARGET_BRANCH_NAME == $CI_DEFAULT_BRANCH || $CI_COMMIT_MESSAGE =~ /--check/ || $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH'
when: always
# test-api-dev:
# stage: test
# image: docker/compose:latest

View File

@ -1,22 +1,22 @@
version: '3.8'
services:
api:
container_name: v3-user
build:
dockerfile: ci/Dockerfile
context: .
env_file:
- ci/.env.ci
ports:
- 5001:5001
depends_on:
- db-test
- broker
networks:
v3-network:
aliases:
- v3-user-api
# api:
# container_name: v3-user
# build:
# dockerfile: ci/Dockerfile
# context: .
# env_file:
# - ci/.env.ci
# ports:
# - 5001:5001
# depends_on:
# - db-test
# - broker
# networks:
# v3-network:
# aliases:
# - v3-user-api
db-test:
container_name: v3-user-db-test

View File

@ -17,10 +17,11 @@
"test": "npm run migrate-test && dotenv -e .env.test jest",
"test:ci": "docker ps && dotenv -e ci/.env.ci -- npx prisma migrate deploy --name postgres-init && dotenv -e ci/.env.ci jest",
"test:unit": "jest --testPathIgnorePatterns 'integration' --verbose",
"test:integration": "dotenv -e .env.test -- npx prisma migrate dev --name postgres-init && dotenv -e .env.test -- jest --testPathPattern 'integration' --verbose",
"test:integration": "npm run migrate-test && dotenv -e .env.test -- jest --testPathPattern 'integration' --verbose",
"test:cov": "npm run migrate-test && dotenv -e .env.test -- jest --coverage",
"test:e2e": "jest --config ./test/jest-e2e.json",
"migrate": "docker exec v3-user sh -c 'npx prisma migrate dev'"
"migrate": "docker exec v3-user sh -c 'npx prisma migrate dev'",
"migrate-test": "dotenv -e .env.test -- npx prisma migrate deploy"
},
"dependencies": {
"@automapper/classes": "^8.7.7",