Skip to content

Commit

Permalink
Merge pull request #700 from crim-ca/fix-docker-compose
Browse files Browse the repository at this point in the history
  • Loading branch information
fmigneault committed Aug 28, 2024
2 parents 6f97ab3 + 31a5243 commit 6f2ac40
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
15 changes: 8 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -797,27 +797,28 @@ docker-push: docker-push-base docker-push-manager docker-push-worker ## push al

# if compose up fails, print the logs and force stop
# if compose up succeeds, query weaver to get frontpage response
DOCKER_COMPOSE_CMD ?= docker compose
DOCKER_TEST_COMPOSES := -f "$(APP_ROOT)/tests/smoke/docker-compose.smoke-test.yml"
DOCKER_TEST_EXEC_ARGS ?=
.PHONY: docker-test
docker-test: docker-build stop ## execute smoke test of the built images (validate that they boots and reply)
@echo "Smoke test of built application docker images"
docker-compose $(DOCKER_TEST_COMPOSES) up -d
$(DOCKER_COMPOSE_CMD) $(DOCKER_TEST_COMPOSES) up -d
sleep 10 ## leave some time to boot
@echo "Pinging Weaver API entrypoint to validate response..."
@curl localhost:4001 | grep "Weaver Information" || \
( docker-compose $(DOCKER_TEST_COMPOSES) logs weaver worker || true && \
docker-compose $(DOCKER_TEST_COMPOSES) stop; exit 1 )
docker-compose $(DOCKER_TEST_COMPOSES) exec $(DOCKER_TEST_EXEC_ARGS) weaver bash /tests/run_tests.sh
docker-compose $(DOCKER_TEST_COMPOSES) stop
( $(DOCKER_COMPOSE_CMD) $(DOCKER_TEST_COMPOSES) logs weaver worker || true && \
$(DOCKER_COMPOSE_CMD) $(DOCKER_TEST_COMPOSES) stop; exit 1 )
$(DOCKER_COMPOSE_CMD) $(DOCKER_TEST_COMPOSES) exec $(DOCKER_TEST_EXEC_ARGS) weaver bash /tests/run_tests.sh
$(DOCKER_COMPOSE_CMD) $(DOCKER_TEST_COMPOSES) stop

.PHONY: docker-stat
docker-stat: ## query docker-compose images status (from 'docker-test')
docker-compose $(DOCKER_TEST_COMPOSES) ps
$(DOCKER_COMPOSE_CMD) $(DOCKER_TEST_COMPOSES) ps

.PHONY: docker-clean
docker-clean: ## remove all built docker images (only matching current/latest versions)
docker-compose $(DOCKER_TEST_COMPOSES) down || true
$(DOCKER_COMPOSE_CMD) $(DOCKER_TEST_COMPOSES) down || true
docker rmi -f "$(DOCKER_REPO):$(APP_VERSION)-manager" || true
docker rmi -f "$(DOCKER_REPO):latest-manager" || true
docker rmi -f "$(APP_NAME):$(APP_VERSION)-manager" || true
Expand Down
1 change: 1 addition & 0 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ mock<4
moto>=4.0.8
mypy
parameterized
path!=16.12.0,!=17.0.0 # patch pytest-shutil (https://github.com/man-group/pytest-plugins/issues/224)
pluggy>=0.7
# FIXME: bad interpolation of 'setup.cfg' for pytest 'log_format' (https://github.com/pytest-dev/pytest/issues/10019)
pytest<7
Expand Down

0 comments on commit 6f2ac40

Please sign in to comment.