diff options
author | Christopher Baines <mail@cbaines.net> | 2019-10-08 19:45:59 +0100 |
---|---|---|
committer | Christopher Baines <mail@cbaines.net> | 2019-10-08 19:45:59 +0100 |
commit | c40747a5ee3fd1f3606d2b9d99b4be7b5ef506c7 (patch) | |
tree | 811ac2bc0544f6f720d540848054051ba9028705 | |
parent | 356a5954b20700f817e9a98aa4a76a3d091bdfba (diff) | |
download | data-service-c40747a5ee3fd1f3606d2b9d99b4be7b5ef506c7.tar data-service-c40747a5ee3fd1f3606d2b9d99b4be7b5ef506c7.tar.gz |
Add a check-with-tmp-database target
This is aimed at testing using pg_tmp, to create a temporary test
database (and instance of PostgreSQL). This is both useful for testing all the
migrations, but should also be useful for running the tests within the guix
package.
-rw-r--r-- | Makefile.am | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/Makefile.am b/Makefile.am index 43c6c2e..a09627b 100644 --- a/Makefile.am +++ b/Makefile.am @@ -49,6 +49,14 @@ install-data-hook: # :( rm -r "$(DESTDIR)$(moddir)/tests" +check-with-tmp-database: + $(eval URI := $(shell pg_tmp)) + $(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" + sqitch deploy --target="$(GUIX_DATA_SERVICE_DATABASE_URI)" + GUIX_DATA_SERVICE_DATABASE_URI="$(GUIX_DATA_SERVICE_DATABASE_URI)" make check + SOURCES = \ guix-data-service/branch-updated-emails.scm \ guix-data-service/builds.scm \ |