From d97d86320b0fc91dc659cc825d1f18a09430b04f Mon Sep 17 00:00:00 2001 From: benedikt-brandtner-bikemap Date: Wed, 22 Mar 2023 07:56:34 +0100 Subject: [PATCH] Do not raise errors with diagnostics code after local test in order to let executors of the script propagate the appropriate status-code (#1519) Propagate the appropriate status-code during failed unit-test runs. (eg.: CI-Runs) --- Makefile | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 083359b6..eecb4ccc 100644 --- a/Makefile +++ b/Makefile @@ -685,11 +685,13 @@ test-sql: clean refresh-docker-images destroy-db start-db-nowait build/import-te awk '1{print; fflush()} $$0~".*ERROR" {txt=$$0} END{ if(txt){print "\n*** ERROR detected, aborting:"; print txt; exit(1)} }' @echo "Test SQL output for Import Test Data" - $(DOCKER_COMPOSE) $(DC_CONFIG_CACHE) run $(DC_OPTS_CACHE) openmaptiles-tools sh -c 'pgwait && psql.sh < tests/test-post-import.sql' + $(DOCKER_COMPOSE) $(DC_CONFIG_CACHE) run $(DC_OPTS_CACHE) openmaptiles-tools sh -c 'pgwait && psql.sh < tests/test-post-import.sql' 2>&1 | \ + awk -v s="ERROR:" '1{print; fflush()} $$0~s{print "*** ERROR detected, aborting"; exit(1)}' @echo "Run UPDATE process on test data..." sed -ir "s/^[#]*\s*DIFF_MODE=.*/DIFF_MODE=true/" .env $(DOCKER_COMPOSE) $(DC_CONFIG_CACHE) run $(DC_OPTS_CACHE) openmaptiles-tools sh -c 'pgwait && import-diff' @echo "Test SQL output for Update Test Data" - $(DOCKER_COMPOSE) $(DC_CONFIG_CACHE) run $(DC_OPTS_CACHE) openmaptiles-tools sh -c 'pgwait && psql.sh < tests/test-post-update.sql' + $(DOCKER_COMPOSE) $(DC_CONFIG_CACHE) run $(DC_OPTS_CACHE) openmaptiles-tools sh -c 'pgwait && psql.sh < tests/test-post-update.sql' 2>&1 | \ + awk -v s="ERROR:" '1{print; fflush()} $$0~s{print "*** ERROR detected, aborting"; exit(1)}'