From 2bc3267cce2f2ba753ccc014a63b508dda584a00 Mon Sep 17 00:00:00 2001 From: Rob Mulholand Date: Wed, 30 Oct 2019 21:19:12 -0500 Subject: [PATCH 1/2] Add driver and user to migrations in tests - Prevents logs that driver is missing - Prevents goose_db_version from hanging around --- Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 2c25191d..8e5d714a 100644 --- a/Makefile +++ b/Makefile @@ -43,7 +43,7 @@ lint: #Test TEST_DB = vulcanize_testing -TEST_CONNECT_STRING = postgresql://localhost:5432/$(TEST_DB)?sslmode=disable +TEST_CONNECT_STRING = postgresql://postgres@localhost:5432/$(TEST_DB)?sslmode=disable .PHONY: test test: | $(GINKGO) $(LINT) @@ -51,8 +51,8 @@ test: | $(GINKGO) $(LINT) go fmt ./... dropdb --if-exists $(TEST_DB) createdb $(TEST_DB) - $(GOOSE) -dir db/migrations "$(TEST_CONNECT_STRING)" up - $(GOOSE) -dir db/migrations "$(TEST_CONNECT_STRING)" reset + $(GOOSE) -dir db/migrations postgres "$(TEST_CONNECT_STRING)" up + $(GOOSE) -dir db/migrations postgres "$(TEST_CONNECT_STRING)" reset make migrate NAME=$(TEST_DB) $(GINKGO) -r --skipPackage=integration_tests,integration From 0167f884b49c5a144586841d06c9e1e507dbc886 Mon Sep 17 00:00:00 2001 From: Rob Mulholand Date: Thu, 31 Oct 2019 13:05:19 -0500 Subject: [PATCH 2/2] Enable configuring db user, host, and port in tests --- Makefile | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/Makefile b/Makefile index 8e5d714a..fc031472 100644 --- a/Makefile +++ b/Makefile @@ -41,9 +41,16 @@ metalint: | $(METALINT) lint: $(LINT) $$($(PKGS)) | grep -v -E "exported (function)|(var)|(method)|(type).*should have comment or be unexported" +#Database +HOST_NAME = localhost +PORT = 5432 +NAME = +USER = postgres +CONNECT_STRING=postgresql://$(USER)@$(HOST_NAME):$(PORT)/$(NAME)?sslmode=disable + #Test TEST_DB = vulcanize_testing -TEST_CONNECT_STRING = postgresql://postgres@localhost:5432/$(TEST_DB)?sslmode=disable +TEST_CONNECT_STRING = postgresql://$(USER)@$(HOST_NAME):$(PORT)/$(TEST_DB)?sslmode=disable .PHONY: test test: | $(GINKGO) $(LINT) @@ -71,13 +78,6 @@ build: go fmt ./... go build -#Database -HOST_NAME = localhost -PORT = 5432 -NAME = -USER = postgres -CONNECT_STRING=postgresql://$(USER)@$(HOST_NAME):$(PORT)/$(NAME)?sslmode=disable - # Parameter checks ## Check that DB variables are provided .PHONY: checkdbvars