Skip to content
Snippets Groups Projects
Commit e5b8dbbb authored by Andrew Kapuscinski's avatar Andrew Kapuscinski
Browse files

refactored unit-test template to run tests inside of service images

parent 2890cabf
No related branches found
No related tags found
No related merge requests found
Pipeline #813 failed
This commit is part of merge request !116. Comments created here will be created in the context of that merge request.
...@@ -114,9 +114,6 @@ unit test dev workflow: ...@@ -114,9 +114,6 @@ unit test dev workflow:
variables: variables:
SERVICE_NAME: "workflow" SERVICE_NAME: "workflow"
extends: .unit-test extends: .unit-test
artifacts:
paths:
- .coverage.${SERVICE_NAME}.${CI_COMMIT_SHORT_SHA}
needs: needs:
- build dev workflow - build dev workflow
...@@ -125,9 +122,6 @@ unit test dev capability: ...@@ -125,9 +122,6 @@ unit test dev capability:
variables: variables:
SERVICE_NAME: "capability" SERVICE_NAME: "capability"
extends: .unit-test extends: .unit-test
artifacts:
paths:
- .coverage.${SERVICE_NAME}.${CI_COMMIT_SHORT_SHA}
needs: needs:
- build dev capability - build dev capability
...@@ -136,9 +130,6 @@ unit test dev notification: ...@@ -136,9 +130,6 @@ unit test dev notification:
variables: variables:
SERVICE_NAME: "notification" SERVICE_NAME: "notification"
extends: .unit-test extends: .unit-test
artifacts:
paths:
- .coverage.${SERVICE_NAME}.${CI_COMMIT_SHORT_SHA}
needs: needs:
- build dev notification - build dev notification
...@@ -166,9 +157,7 @@ unit test coverage: ...@@ -166,9 +157,7 @@ unit test coverage:
- unit test dev notification - unit test dev notification
rules: rules:
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
when: always
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"' - if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
when: always
# Push Stages # Push Stages
push dev workflow: push dev workflow:
...@@ -248,7 +237,6 @@ pages: ...@@ -248,7 +237,6 @@ pages:
expire_in: 2 weeks expire_in: 2 weeks
rules: rules:
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
when: always
# Development # Development
deploy dev: deploy dev:
......
.unit-test: .unit-test:
image: ${REGISTRY_URL}/${PROJECT_NAME}/${SERVICE_NAME}:${CI_COMMIT_SHORT_SHA}
script: script:
- IMAGE_NAME="${REGISTRY_URL}/${PROJECT_NAME}/${SERVICE_NAME}" - cd /code && ./bin/run-tests.sh -b
- TEST_CONTAINER="${SERVICE_NAME}-${CI_COMMIT_SHORT_SHA}" - ls -la
- docker run --name "${TEST_CONTAINER}" ${IMAGE_NAME}:${CI_COMMIT_SHORT_SHA} ./bin/run-tests.sh -b - mv .coverage .coverage.${SERVICE_NAME}.${CI_COMMIT_SHORT_SHA}
- docker cp "${TEST_CONTAINER}":/code/.coverage ./.coverage.${SERVICE_NAME}.${CI_COMMIT_SHORT_SHA} artifacts:
- docker container stop "${TEST_CONTAINER}" && docker container rm "${TEST_CONTAINER}" paths:
- .coverage.${SERVICE_NAME}.${CI_COMMIT_SHORT_SHA}
rules: rules:
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
when: always - if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"' \ No newline at end of file
when: always
\ No newline at end of file
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