Skip to content
Snippets Groups Projects
Commit cc236462 authored by Javi Moreno's avatar Javi Moreno
Browse files

Changes in the unit test automation

parent ac587367
No related branches found
No related tags found
1 merge request!54Release 2.0.0
variables:
IMAGE_NAME: 'monitoring' # name of the microservice
IMAGE_NAME_TEST: 'monitoring-test' # name of the microservice
IMAGE_TAG: 'latest' # tag of the container image (production, development, etc)
# build the Docker image
......@@ -12,15 +13,6 @@ build monitoring:
- src/$IMAGE_NAME/**
- .gitlab-ci.yml
build monitoring test:
stage: build
script:
- docker build -t "$IMAGE_NAME:$IMAGE_TAG" -f ./src/$IMAGE_NAME/tests/Dockerfile ./src/
rules:
- changes:
- src/$IMAGE_NAME/**
- .gitlab-ci.yml
# tags the Docker image
tag monitoring:
stage: build
......@@ -84,11 +76,15 @@ test monitoring run:
test monitoring pytest:
stage: test
needs:
- build monitoring test
before_script:
- if docker network list | grep teraflowbridge; then echo "teraflowbridge is already created"; else docker network create -d bridge teraflowbridge; fi
- build monitoring
script:
- docker run -d -p 7070:7070 --name monitoring-tests --network=teraflowbridge --rm "$IMAGE_NAME:$IMAGE_TAG"
after_script:
- docker stop monitoring-tests
- docker build -t "$IMAGE_NAME_TEST:$IMAGE_TAG" -f ./src/$IMAGE_NAME_TEST/tests/Dockerfile ./src/ > pytest_report.txt
rules:
- changes:
- src/$IMAGE_NAME/**
- .gitlab-ci.yml
artifacts:
when: always
paths:
- pytest_report.txt
expire_in: 1 day
\ No newline at end of file
......@@ -27,4 +27,4 @@ COPY common/logger.py .
ENV PORT=7070
EXPOSE 7070
RUN pytest
RUN pytest --junitxml=report.xml
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