feat: execute test with docker compose (#101)
All checks were successful
continuous-integration/drone/push Build is passing
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:
24
Makefile
24
Makefile
@@ -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}'
|
||||
|
Reference in New Issue
Block a user