Skip to content

Commit

Permalink
build(make): Run acceptance tests without rebuilding the containers
Browse files Browse the repository at this point in the history
Removed the dependency on `docker-acceptance` for the
`test-acceptance-run`.

Signed-off-by: Alf-Rune Siqveland <alf.rune@northern.tech>
  • Loading branch information
alfrunes committed Sep 5, 2024
1 parent 44e5b7f commit ce241cc
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 10 deletions.
2 changes: 1 addition & 1 deletion backend/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ test-acceptance: $(TEST_ACCEPTANCE_TARGETS)

.PHONY: $(TEST_ACCEPTANCE_TARGETS)
$(TEST_ACCEPTANCE_TARGETS):
@$(MAKE) -C services/$(subst -test-acceptance,,$@) test-acceptance
@$(MAKE) -C services/$(subst -test-acceptance,,$@) test-acceptance-run

.PHONY: test-integration
test-integration:
Expand Down
16 changes: 10 additions & 6 deletions backend/services/Makefile.common
Original file line number Diff line number Diff line change
Expand Up @@ -89,20 +89,24 @@ docker-acceptance: docker

ifndef _no_include_acceptance_tests

test_acceptance_run_deps ?= docker-acceptance
test_acceptance_run_deps ?=

.PHONY: test-acceptance-run

# NOTE: Have to first run `docker compose up --remove-orphans` to remove
# unneeded containers because `--remove-orphans` has no effect for
# the run command.
test-acceptance-run: $(test_acceptance_run_deps)
MENDER_IMAGE_PREFIX=$(MENDER_IMAGE_PREFIX) \
MENDER_IMAGE_TAG_TEST=$(MENDER_IMAGE_TAG_TEST) \
docker compose -f tests/docker-compose.yml run \
docker compose -f tests/docker-compose.yml up \
--remove-orphans \
--rm \
--detach \
acceptance-tester && \
docker compose -f tests/docker-compose.yml run \
--use-aliases \
acceptance-tester $(PYTEST_ARGS)

.PHONY: test-acceptance
test-acceptance: test-acceptance-run
test-acceptance: docker-acceptance test-acceptance-run
docker compose -f tests/docker-compose.yml down --remove-orphans -v

endif # _no_include_acceptance_tests
2 changes: 1 addition & 1 deletion backend/services/deviceconfig/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@ tests/%: docs/%.yml
.PHONY: docs
docs: $(patsubst docs/%.yml,tests/%,$(DOCFILES))

test_acceptance_run_deps := docker-acceptance docs
test_acceptance_run_deps := docs

include ../Makefile.common
2 changes: 1 addition & 1 deletion backend/services/deviceconnect/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@ tests/%: docs/%.yml
.PHONY: docs
docs: $(patsubst docs/%.yml,tests/%,$(DOCFILES))

test_acceptance_run_deps := docker-acceptance docs
test_acceptance_run_deps := docs

include ../Makefile.common
2 changes: 1 addition & 1 deletion backend/services/iot-manager/Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
COMPONENT := iot-manager

test_acceptance_run_deps := docker-acceptance docs
test_acceptance_run_deps := docs

include ../Makefile.common

Expand Down

0 comments on commit ce241cc

Please sign in to comment.