69 lines
2.2 KiB
Text
69 lines
2.2 KiB
Text
SHELL := /bin/bash
|
|
PYTEST_MARK ?= shard_1_of_1
|
|
|
|
export PATH := ./venv/bin:$(PATH)
|
|
|
|
.PHONY: all unit-test registry-test registry-test-old test
|
|
|
|
all: test
|
|
|
|
unit-test:
|
|
TEST=true PYTHONPATH="." ENCRYPTED_ROBOT_TOKEN_MIGRATION_PHASE=remove-old-fields py.test \
|
|
-m $(PYTEST_MARK) \
|
|
--cov="." --cov-report=html --cov-report=term-missing \
|
|
--timeout=3600 --verbose -x \
|
|
./
|
|
|
|
registry-test:
|
|
TEST=true PYTHONPATH="." ENCRYPTED_ROBOT_TOKEN_MIGRATION_PHASE=remove-old-fields py.test \
|
|
-m $(PYTEST_MARK) \
|
|
--cov="." --cov-report=html --cov-report=term-missing \
|
|
--timeout=3600 --verbose --show-count -x \
|
|
test/registry/registry_tests.py
|
|
|
|
registry-test-old:
|
|
TEST=true PYTHONPATH="." ENCRYPTED_ROBOT_TOKEN_MIGRATION_PHASE=remove-old-fields py.test \
|
|
--cov="." --cov-report=html --cov-report=term-missing \
|
|
--timeout=3600 --verbose --show-count -x \
|
|
./test/registry_tests.py
|
|
|
|
certs-test:
|
|
./test/test_certs_install.sh
|
|
|
|
gunicorn-tests:
|
|
./test/test_gunicorn_running.sh
|
|
|
|
full-db-test: ensure-test-db
|
|
TEST=true PYTHONPATH=. QUAY_OVERRIDE_CONFIG='{"DATABASE_SECRET_KEY": "anothercrazykey!"}' \
|
|
ENCRYPTED_ROBOT_TOKEN_MIGRATION_PHASE=remove-old-fields alembic upgrade head
|
|
TEST=true PYTHONPATH=. ENCRYPTED_ROBOT_TOKEN_MIGRATION_PHASE=remove-old-fields \
|
|
SKIP_DB_SCHEMA=true py.test --timeout=7200 \
|
|
-m $(PYTEST_MARK) \
|
|
--verbose --show-count -x --ignore=endpoints/appr/test/ \
|
|
./
|
|
|
|
test: unit-test registry-test
|
|
|
|
ensure-test-db:
|
|
@if [ -z $(TEST_DATABASE_URI) ]; then \
|
|
echo "TEST_DATABASE_URI is undefined"; \
|
|
exit 1; \
|
|
fi
|
|
|
|
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
|