From 3b52f437b128428a9aaf1795997636d63ead2212 Mon Sep 17 00:00:00 2001 From: Charlton Austin Date: Tue, 11 Jul 2017 14:41:03 -0400 Subject: [PATCH] feat(Makefile): add in new postgres target this adds in a new target that allows you to run postgres tests with a single command Issue: NA - [ ] It works! - [ ] Comments provide sufficient explanations for the next contributor - [ ] Tests cover changes and corner cases - [ ] Follows Quay syntax patterns and format --- Makefile | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/Makefile b/Makefile index 41b48faa6..e728ea6bb 100644 --- a/Makefile +++ b/Makefile @@ -47,6 +47,23 @@ test: unit test/registry_tests.py TEST=true PYTHONPATH="." py.test --timeout=3600 --verbose --show-count -x \ test/registry_tests.py +PG_PASSWORD := quay +PG_USER := quay +PG_HOST := postgresql://$(PG_USER):$(PG_PASSWORD)@localhost/quay + +test_postgres : TEST_ENV := SKIP_DB_SCHEMA=true TEST=true \ + TEST_DATABASE_URI=$(PG_HOST) PYTHONPATH=. + +test_postgres: + docker rm -f postgres-testrunner-postgres || true + docker run --name postgres-testrunner-postgres \ + -e POSTGRES_PASSWORD=$(PG_PASSWORD) -e POSTGRES_USER=${PG_USER} \ + -p 5432:5432 -d postgres:9.2 + until pg_isready -d $(PG_HOST); do sleep 1; echo "Waiting for postgres"; done + $(TEST_ENV) alembic upgrade head + $(TEST_ENV) py.test --timeout=7200 --verbose --show-count ./ --color=no \ + --ignore=endpoints/appr/test/ -x + docker rm -f postgres-testrunner-postgres || true WEBPACK := node_modules/.bin/webpack $(WEBPACK): package.json