From ce241cc9cb5da92372787fbcd236a8b43c705242 Mon Sep 17 00:00:00 2001 From: Alf-Rune Siqveland Date: Wed, 4 Sep 2024 16:18:11 +0200 Subject: [PATCH] build(make): Run acceptance tests without rebuilding the containers Removed the dependency on `docker-acceptance` for the `test-acceptance-run`. Signed-off-by: Alf-Rune Siqveland --- backend/Makefile | 2 +- backend/services/Makefile.common | 16 ++++++++++------ backend/services/deviceconfig/Makefile | 2 +- backend/services/deviceconnect/Makefile | 2 +- backend/services/iot-manager/Makefile | 2 +- 5 files changed, 14 insertions(+), 10 deletions(-) diff --git a/backend/Makefile b/backend/Makefile index 688075e0..125625e0 100644 --- a/backend/Makefile +++ b/backend/Makefile @@ -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: diff --git a/backend/services/Makefile.common b/backend/services/Makefile.common index 90cfa60a..0f25de90 100644 --- a/backend/services/Makefile.common +++ b/backend/services/Makefile.common @@ -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 diff --git a/backend/services/deviceconfig/Makefile b/backend/services/deviceconfig/Makefile index 90825fa3..0eca0b84 100644 --- a/backend/services/deviceconfig/Makefile +++ b/backend/services/deviceconfig/Makefile @@ -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 diff --git a/backend/services/deviceconnect/Makefile b/backend/services/deviceconnect/Makefile index 8616630d..e387ea21 100644 --- a/backend/services/deviceconnect/Makefile +++ b/backend/services/deviceconnect/Makefile @@ -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 diff --git a/backend/services/iot-manager/Makefile b/backend/services/iot-manager/Makefile index 1646bcf4..52318d00 100644 --- a/backend/services/iot-manager/Makefile +++ b/backend/services/iot-manager/Makefile @@ -1,6 +1,6 @@ COMPONENT := iot-manager -test_acceptance_run_deps := docker-acceptance docs +test_acceptance_run_deps := docs include ../Makefile.common