aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Baines <mail@cbaines.net>2019-10-11 08:32:48 +0100
committerChristopher Baines <mail@cbaines.net>2019-10-11 08:32:48 +0100
commiteb1709c8e452ed4a56c94d3dc86042aa4caad0e8 (patch)
tree5dce414281d65a13e30fad6153668e2b1c372bee
parentc40747a5ee3fd1f3606d2b9d99b4be7b5ef506c7 (diff)
downloaddata-service-eb1709c8e452ed4a56c94d3dc86042aa4caad0e8.tar
data-service-eb1709c8e452ed4a56c94d3dc86042aa4caad0e8.tar.gz
Improve the check-with-tmp-database target
To better manage the environment, and stop the database upon completion of the tests.
-rw-r--r--Makefile.am12
1 files changed, 8 insertions, 4 deletions
diff --git a/Makefile.am b/Makefile.am
index a09627b..a2d1bfb 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -50,12 +50,16 @@ install-data-hook:
rm -r "$(DESTDIR)$(moddir)/tests"
check-with-tmp-database:
- $(eval URI := $(shell pg_tmp))
+ $(eval TMP_DATABASE := $(shell mktemp -d -t guix-data-service-database-XXXX))
+ $(eval URI := $(shell pg_tmp -d "$(TMP_DATABASE)"))
$(eval GUIX_DATA_SERVICE_DATABASE_URI := $(patsubst postgresql:///test%,postgresql://guix_data_service@localhost/guix_data_service_test%,$(URI)))
- psql "$(URI)" --command="CREATE USER guix_data_service"
- psql "$(URI)" --command="CREATE DATABASE guix_data_service_test WITH OWNER guix_data_service"
+ psql --no-psqlrc "$(URI)" --command="CREATE USER guix_data_service"
+ psql --no-psqlrc "$(URI)" --command="CREATE DATABASE guix_data_service_test WITH OWNER guix_data_service"
sqitch deploy --target="$(GUIX_DATA_SERVICE_DATABASE_URI)"
- GUIX_DATA_SERVICE_DATABASE_URI="$(GUIX_DATA_SERVICE_DATABASE_URI)" make check
+# Set TZ and SQITCH_USER_CONFIG to avoid Sqitch tripping up in a minimal
+# environment, like a Guix package
+ TZ=UTC SQITCH_USER_CONFIG=/dev/null GUIX_DATA_SERVICE_DATABASE_URI="$(GUIX_DATA_SERVICE_DATABASE_URI)" make check
+ pg_tmp stop -w 1 -d "$(TMP_DATABASE)"
SOURCES = \
guix-data-service/branch-updated-emails.scm \