Jenkinsfile: use pg_virtualenv to isolate test database (#31437)

This commit is contained in:
Benjamin Dauvergne 2019-03-14 20:41:42 +01:00
parent d361088985
commit 43b3f5ddb1
3 changed files with 13 additions and 4 deletions

View File

@ -11,4 +11,4 @@ done
virtualenv venv
venv/bin/pip install tox
venv/bin/tox -rv
pg_virtualenv venv/bin/tox -rv

View File

@ -9,13 +9,18 @@ PASSWORD_HASHERS = ['django.contrib.auth.hashers.UnsaltedMD5PasswordHasher'] + l
A2_CACHE_ENABLED = False
LANGUAGE_CODE = 'en'
DATABASES = {
'default': {
'ENGINE': os.environ.get('DB_ENGINE', 'django.db.backends.sqlite3'),
'TEST': {
'NAME': 'a2-test-%s' % os.environ.get("BRANCH_NAME", "").replace('/', '-'),
},
'NAME': 'authentic2',
}
}
if 'postgres' in DATABASES['default']['ENGINE']:
for key in ('PGPORT', 'PGHOST', 'PGUSER', 'PGPASSWORD'):
if key in os.environ:
DATABASES['default'][key[2:]] = os.environ[key]
ALLOWED_HOSTS = ALLOWED_HOSTS + ['example.net', 'cache1.example.com', 'cache2.example.com']

View File

@ -23,6 +23,10 @@ setenv =
reusedb: REUSEDB=--reuse-db
A2_TESTS=tests
oldldap: A2_TESTS=tests/test_ldap.py
PGPORT={env:PGPORT:}
PGHOST={env:PGHOST:}
PGUSER={env:PGUSER:}
PGPASSWORD={env:PGPASSWORD:}
usedevelop =
coverage: True
nocoverage: False