feat: execute test with docker compose (#101)
All checks were successful
continuous-integration/drone/push Build is passing

When we changed the application to be executed as distributed nodes (PR #96), performing tests with `docker-compose` became impossible.

To fix this situation in this PR, two new targets are added to `Makefile`:

* `compose_test`
* `compose_test_shell`

These new targets allow one to execute tests and enter the container shell responsible for running these tests.

Reviewed-on: #101
Co-authored-by: Joao P Dubas <joao.dubas+gitea@gmail.com>
Co-committed-by: Joao P Dubas <joao.dubas+gitea@gmail.com>
This commit is contained in:
2024-10-07 12:16:07 +00:00
committed by João Paulo Dubas
parent 0ae8bf53a2
commit 5e029670eb
2 changed files with 50 additions and 8 deletions

View File

@@ -28,14 +28,6 @@ static_code_analysis: check_format credo dialyzer ## run static code analysis
test: ## run tests
@mix test --cover --trace --slowest 10
.PHONY: compose_up
compose_up: ## start containers for this service
@$(COMPOSE) up -d
.PHONY: compose_watch
compose_watch: ## start containers for this service watching for updates in filesystem
@$(COMPOSE) up -w
.PHONY: compose_database_create
compose_database_create:
@$(COMPOSE) run --rm --entrypoint mix app ecto.create
@@ -55,6 +47,22 @@ compose_ps: ## status of containers
compose_remote: ## connect to remote node
@$(COMPOSE) exec app ./priv/docker/service/docker-remote.sh
.PHONY: compose_test
compose_test: ## execute test on docker environment
@$(COMPOSE) --profile test run --rm test
.PHONY: compose_test_shell
compose_test_shell: ## enter test environment shell
@$(COMPOSE) --profile test run --rm --entrypoint bash test -c bash
.PHONY: compose_up
compose_up: ## start containers for this service
@$(COMPOSE) up -d
.PHONY: compose_watch
compose_watch: ## start containers for this service watching for updates in filesystem
@$(COMPOSE) up -w
.PHONY: help
help:
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'