diff --git a/src/context/.gitlab-ci.yml b/src/context/.gitlab-ci.yml index 8c80196acbde2cb9734f7ae7200563c9e80aa37d..feb894bf1546d1f66c5cc812eabdadaa0f3022dd 100644 --- a/src/context/.gitlab-ci.yml +++ b/src/context/.gitlab-ci.yml @@ -11,16 +11,13 @@ build context: - docker build -t "$IMAGE_NAME:$IMAGE_TAG" -f ./src/$IMAGE_NAME/Dockerfile ./src/ - docker tag "$IMAGE_NAME:$IMAGE_TAG" "$CI_REGISTRY_IMAGE/$IMAGE_NAME:$IMAGE_TAG" - docker push "$CI_REGISTRY_IMAGE/$IMAGE_NAME:$IMAGE_TAG" - - docker build -t "$IMAGE_NAME_TEST:$IMAGE_TAG" -f ./src/$IMAGE_NAME/tests/Dockerfile ./src/ - - docker tag "$IMAGE_NAME_TEST:$IMAGE_TAG" "$CI_REGISTRY_IMAGE/$IMAGE_NAME_TEST:$IMAGE_TAG" - - docker push "$CI_REGISTRY_IMAGE/$IMAGE_NAME_TEST:$IMAGE_TAG" rules: - changes: - src/$IMAGE_NAME/** - .gitlab-ci.yml -# Pull, execute, and test the Docker image from the GitLab registry -test context: +# Pull, execute, and run unitary tests for the Docker image from the GitLab registry +test unitary context: variables: IMAGE_NAME: 'context' # name of the microservice IMAGE_NAME_TEST: 'context-test' # name of the microservice @@ -34,10 +31,9 @@ test context: script: - docker pull "$CI_REGISTRY_IMAGE/$IMAGE_NAME:$IMAGE_TAG" - docker run -d -p 1010:1010 --name $IMAGE_NAME --network=teraflowbridge --rm "$IMAGE_NAME:$IMAGE_TAG" - - docker ps > deploy_test_report.txt - - docker run -d --name $IMAGE_NAME_TEST --network=teraflowbridge --rm "$IMAGE_NAME_TEST:$IMAGE_TAG" > pytest_report.txt + - docker ps > $IMAGE_NAME--deploy_test_report.txt + - docker exec -i $IMAGE --network=teraflowbridge "pytest --log-level=DEBUG --verbose $IMAGE_NAME/tests/test_unitary.py" > $IMAGE_NAME--pytest_unitary_report.txt after_script: - - docker stop $IMAGE_NAME_TEST - docker stop $IMAGE_NAME rules: - changes: @@ -46,8 +42,8 @@ test context: artifacts: when: always paths: - - deploy_test_report.txt - - pytest_report.txt + - $IMAGE_NAME--deploy_test_report.txt + - $IMAGE_NAME--pytest_unitary_report.txt expire_in: 1 day # Deployment of the monitoring service in Kubernetes Cluster diff --git a/src/context/tests/Dockerfile b/src/context/tests/Dockerfile index 5487a3ac9b1f5f72415d9dce37396675301a6822..ed70aa86e5c2db5eddb8bf7fc4106bdcc7f8323c 100644 --- a/src/context/tests/Dockerfile +++ b/src/context/tests/Dockerfile @@ -1,4 +1,4 @@ -FROM context_service:develop +FROM context:latest # Run integration tests ENTRYPOINT ["pytest", "-v", "--log-level=DEBUG", "context/tests/test_integration.py"] diff --git a/src/device/.gitlab-ci.yml b/src/device/.gitlab-ci.yml index d2840502a04b0451e85da43a89f96c38a0a22027..c8e7716e0326e17dfc46727de07a485abdfefb00 100644 --- a/src/device/.gitlab-ci.yml +++ b/src/device/.gitlab-ci.yml @@ -11,16 +11,13 @@ build device: - docker build -t "$IMAGE_NAME:$IMAGE_TAG" -f ./src/$IMAGE_NAME/Dockerfile ./src/ - docker tag "$IMAGE_NAME:$IMAGE_TAG" "$CI_REGISTRY_IMAGE/$IMAGE_NAME:$IMAGE_TAG" - docker push "$CI_REGISTRY_IMAGE/$IMAGE_NAME:$IMAGE_TAG" - - docker build -t "$IMAGE_NAME_TEST:$IMAGE_TAG" -f ./src/$IMAGE_NAME/tests/Dockerfile ./src/ - - docker tag "$IMAGE_NAME_TEST:$IMAGE_TAG" "$CI_REGISTRY_IMAGE/$IMAGE_NAME_TEST:$IMAGE_TAG" - - docker push "$CI_REGISTRY_IMAGE/$IMAGE_NAME_TEST:$IMAGE_TAG" rules: - changes: - src/$IMAGE_NAME/** - .gitlab-ci.yml -# Pull, execute, and test the Docker image from the GitLab registry -test device: +# Pull, execute, and run unitary tests for the Docker image from the GitLab registry +test unitary device: variables: IMAGE_NAME: 'device' # name of the microservice IMAGE_NAME_TEST: 'device-test' # name of the microservice @@ -34,10 +31,9 @@ test device: script: - docker pull "$CI_REGISTRY_IMAGE/$IMAGE_NAME:$IMAGE_TAG" - docker run -d -p 1010:1010 --name $IMAGE_NAME --network=teraflowbridge --rm "$IMAGE_NAME:$IMAGE_TAG" - - docker ps > deploy_test_report.txt - - docker run -d --name $IMAGE_NAME_TEST --network=teraflowbridge --rm "$IMAGE_NAME_TEST:$IMAGE_TAG" > pytest_report.txt + - docker ps > $IMAGE_NAME--deploy_test_report.txt + - docker exec -i $IMAGE --network=teraflowbridge "pytest --log-level=DEBUG --verbose $IMAGE_NAME/tests/test_unitary.py" > $IMAGE_NAME--pytest_unitary_report.txt after_script: - - docker stop $IMAGE_NAME_TEST - docker stop $IMAGE_NAME rules: - changes: @@ -46,8 +42,8 @@ test device: artifacts: when: always paths: - - deploy_test_report.txt - - pytest_report.txt + - $IMAGE_NAME--deploy_test_report.txt + - $IMAGE_NAME--pytest_unitary_report.txt expire_in: 1 day # Deployment of the monitoring service in Kubernetes Cluster diff --git a/src/device/tests/Dockerfile b/src/device/tests/Dockerfile index b1f6411c39007897e3d0bc0eb7506545be57c524..e8789ce7442b58063f96970d2f52b8c31b1818c5 100644 --- a/src/device/tests/Dockerfile +++ b/src/device/tests/Dockerfile @@ -1,4 +1,4 @@ -FROM device_service:develop +FROM device:latest # Run integration tests ENTRYPOINT ["pytest", "-v", "--log-level=DEBUG", "device/tests/test_integration.py"]