This is an automated email from the ASF dual-hosted git repository. kevinjqliu pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/iceberg-python.git
The following commit(s) were added to refs/heads/main by this push: new db89d136 add docker cleanup to integration tests (#2465) db89d136 is described below commit db89d1360e189990d99348c6665d3afa6b008d36 Author: Drew Gallardo <img...@gmail.com> AuthorDate: Tue Sep 16 09:18:08 2025 -0700 add docker cleanup to integration tests (#2465) related to #2425 # Rationale for this change This PR updates the Makefile's test-integration target to cleanup the docker containers by default. Also, adds a variable (`KEEP_COMPOSE`) that can ignore the cleanup for development purposes. but the setup ## Are these changes tested? yes ## Are there any user-facing changes? no --- Makefile | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 6bc55e94..fe080764 100644 --- a/Makefile +++ b/Makefile @@ -21,6 +21,7 @@ PYTEST_ARGS ?= -v # Override with e.g. PYTEST_ARGS="-vv --tb=short" COVERAGE ?= 0 # Set COVERAGE=1 to enable coverage: make test COVERAGE=1 COVERAGE_FAIL_UNDER ?= 85 # Minimum coverage % to pass: make coverage-report COVERAGE_FAIL_UNDER=70 +KEEP_COMPOSE ?= 0 # Set KEEP_COMPOSE=1 to keep containers after integration tests ifeq ($(COVERAGE),1) TEST_RUNNER = poetry run coverage run --parallel-mode --source=pyiceberg -m @@ -28,6 +29,12 @@ else TEST_RUNNER = poetry run endif +ifeq ($(KEEP_COMPOSE),1) + CLEANUP_COMMAND = echo "Keeping containers running for debugging (KEEP_COMPOSE=1)" +else + CLEANUP_COMMAND = docker compose -f dev/docker-compose-integration.yml down -v --remove-orphans 2>/dev/null || true +endif + POETRY_VERSION = 2.1.4 # ============ @@ -85,7 +92,7 @@ lint: ## Run code linters via pre-commit test: ## Run all unit tests (excluding integration) $(TEST_RUNNER) pytest tests/ -m "(unmarked or parametrize) and not integration" $(PYTEST_ARGS) -test-integration: test-integration-setup test-integration-exec ## Run integration tests +test-integration: test-integration-setup test-integration-exec test-integration-cleanup ## Run integration tests test-integration-setup: ## Start Docker services for integration tests docker compose -f dev/docker-compose-integration.yml kill @@ -98,6 +105,12 @@ test-integration-setup: ## Start Docker services for integration tests test-integration-exec: ## Run integration tests (excluding provision) $(TEST_RUNNER) pytest tests/ -m integration $(PYTEST_ARGS) +test-integration-cleanup: ## Clean up integration test environment + @if [ "${KEEP_COMPOSE}" != "1" ]; then \ + echo "Cleaning up Docker containers..."; \ + fi + $(CLEANUP_COMMAND) + test-integration-rebuild: ## Rebuild integration Docker services from scratch docker compose -f dev/docker-compose-integration.yml kill docker compose -f dev/docker-compose-integration.yml rm -f