Skip to content
Snippets Groups Projects
Commit 72545b17 authored by s80984's avatar s80984
Browse files

Update Test Job

parent 0c33719b
No related branches found
No related tags found
No related merge requests found
Pipeline #14150 failed
...@@ -43,7 +43,7 @@ job_build-image: ...@@ -43,7 +43,7 @@ job_build-image:
# - docker info # - docker info
# - docker-compose --version # - docker-compose --version
script: script:
- docker-compose up -d - docker-compose up -d --build
# - docker-compose up -d --build # - docker-compose up -d --build
# # - docker ps # # - docker ps
# # - docker network list # # - docker network list
...@@ -71,21 +71,21 @@ job_test-image: ...@@ -71,21 +71,21 @@ job_test-image:
before_script: before_script:
- apk add --no-cache docker-compose - apk add --no-cache docker-compose
script: script:
- docker-compose -f docker-compose.test.yml up - docker-compose -f docker-compose.test.yml up --build
# - npm run test # - npm run test
# - docker run # - docker run
# --detach # --detach
# --publish "${outerPort}:8080" # --publish "${outerPort}:8080"
# --name "${CI_PROJECT_ID}-${CI_PIPELINE_IID}" # --name "${CI_PROJECT_ID}-${CI_PIPELINE_IID}"
# "${CI_REGISTRY_IMAGE}:${CI_PIPELINE_IID}-${CI_COMMIT_SHORT_SHA}" # "${CI_REGISTRY_IMAGE}:${CI_PIPELINE_IID}-${CI_COMMIT_SHORT_SHA}"
- | # - |
attempts=1 # attempts=1
while (wget "http://containerhost:${outerPort}" 2>&1 || true) | grep 'Connection refused' && [ "${attempts}" -lt 5 ]; do # while (wget "http://containerhost:${outerPort}" 2>&1 || true) | grep 'Connection refused' && [ "${attempts}" -lt 5 ]; do
sleep 1 && echo sleeping # sleep 1 && echo sleeping
attempts=$((attempts + 1)) # attempts=$((attempts + 1))
done # done
- (wget --no-cache --quiet --output-document - "http://containerhost:${outerPort}/health" | docker run --rm --interactive stedolan/jq -e '.status == "pass"') # - (wget --no-cache --quiet --output-document - "http://containerhost:${outerPort}/health" | docker run --rm --interactive stedolan/jq -e '.status == "pass"')
|| (echo 'Test failed' && exit 1) # || (echo 'Test failed' && exit 1)
after_script: after_script:
# NOTE: clean up after test run (stop and remove container) # NOTE: clean up after test run (stop and remove container)
# - docker rm --force "${CI_PROJECT_ID}-${CI_PIPELINE_IID}" # - docker rm --force "${CI_PROJECT_ID}-${CI_PIPELINE_IID}"
......
...@@ -43,5 +43,5 @@ COPY . . ...@@ -43,5 +43,5 @@ COPY . .
EXPOSE 3000 EXPOSE 3000
CMD [ "npm", "start" ] # CMD [ "npm", "start" ]
CMD [ "npm", "run", "test" ] CMD [ "npm", "run", "test" ]
...@@ -8,7 +8,7 @@ services: ...@@ -8,7 +8,7 @@ services:
volumes: volumes:
- mongodb:/.local/db/data/db - mongodb:/.local/db/data/db
app: app:
container_name: node-mongo-app container_name: node-mongo-app-test
# image: ${CI_REGISTRY_IMAGE}:${CI_PIPELINE_IID}-${CI_COMMIT_SHORT_SHA} # image: ${CI_REGISTRY_IMAGE}:${CI_PIPELINE_IID}-${CI_COMMIT_SHORT_SHA}
restart: always restart: always
build: build:
......
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