Skip to content
Snippets Groups Projects
Commit 3e61c7b5 authored by Dobromir Palushev's avatar Dobromir Palushev
Browse files

Merge branch 'just-a-test' into 'staging'

updated logic of the test-job

See merge request !40
parents 6721686d 671be61d
No related branches found
No related tags found
14 merge requests!72Production update,!70Production update,!67Workflow updates,!66Css test change,!64Pipeline fix,!62Main update,!60Getting staging's latest state,!58Updating Main,!56Main updates,!52Staging->Main,!50Production updates,!47Deployment on main,!45Deployment from main,!40updated logic of the test-job
Pipeline #19168 failed
......@@ -38,7 +38,7 @@ run-tests:
alias: localhost
script:
- docker run -p 27017:27017
--detached
--detach
--name mongo-container
--rm
--network=host
......@@ -49,7 +49,8 @@ run-tests:
--network=host
--build-arg MONGODB_URL_TEST=mongodb://localhost:27017/todo-app
--build-arg JWT_SECRET_TEST=my-very-secret-jwt
--add-host=host.docker.internal:localhost
--add-host=host.docker.internal:host-gateway
--file Dockerfile.test
"./app"
after_script:
- docker stop mongo-container
......
......@@ -14,35 +14,6 @@ ENV \
MONGODB_URL=<dynamically-set-from-k8s> \
JWT_SECRET=<dynamically-set-from-k8s>
# ------------------------------------------------------------------
# # Test stage
# FROM base AS test
# # client tests
# WORKDIR /client
# COPY ./client .
# RUN npm ci --no-audit --no-fund
# RUN npm run test
# # server tests
# WORKDIR /server
# COPY ./server/src ./src/
# COPY ./server/package*.json ./
# RUN npm ci --no-audit --no-fund
# ARG MONGODB_URL_TEST
# ARG JWT_SECRET_TEST
# # MONGODB_URL and JWT_SECRET are available as env variables
# RUN MONGODB_URL=$MONGODB_URL_TEST JWT_SECRET=$JWT_SECRET_TEST npm run test
# ------------------------------------------------------------------
# Build stage
FROM base AS build
......
ARG NODEJS_VERSION='16.17.0'
# Test stage
FROM node:$NODEJS_VERSION-alpine
# client tests
WORKDIR /client
COPY ./client .
RUN npm ci --no-audit --no-fund
RUN npm run test
# server tests
WORKDIR /server
COPY ./server/src ./src/
COPY ./server/package*.json ./
RUN npm ci --no-audit --no-fund
ARG \
MONGODB_URL_TEST=mongodb://host.docker.internal:27017/todo-app \
JWT_SECRET_TEST=<my-very-secret-jwt>
# MONGODB_URL and JWT_SECRET are available as env variables
RUN MONGODB_URL=$MONGODB_URL_TEST JWT_SECRET=$JWT_SECRET_TEST npm run test
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment