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