Project

General

Profile

0002-Jenkinsfile-use-pg_virtualenv-to-isolate-test-databa.patch

Benjamin Dauvergne, 14 Mar 2019 08:43 PM

Download (1.6 KB)

View differences:

Subject: [PATCH 2/2] Jenkinsfile: use pg_virtualenv to isolate test database
 (#31437)

 jenkins.sh        | 2 +-
 tests/settings.py | 6 +++++-
 tox.ini           | 1 +
 3 files changed, 7 insertions(+), 2 deletions(-)
jenkins.sh
11 11

  
12 12
virtualenv venv
13 13
venv/bin/pip install tox
14
venv/bin/tox -rv
14
pg_virtualenv venv/bin/tox -rv
tests/settings.py
9 9
A2_CACHE_ENABLED = False
10 10

  
11 11
LANGUAGE_CODE = 'en'
12

  
12 13
DATABASES = {
13 14
    'default': {
14 15
        'ENGINE': os.environ.get('DB_ENGINE', 'django.db.backends.sqlite3'),
15 16
        'TEST': {
16
            'NAME': 'a2-test-%s' % os.environ.get("BRANCH_NAME", "").replace('/', '-'),
17
            'NAME': 'a2-test'
17 18
        },
18 19
    }
19 20
}
21
if 'PGPORT' in os.environ:
22
    DATABASES['default']['PORT'] = os.environ['PGPORT']
23

  
20 24

  
21 25
ALLOWED_HOSTS = ALLOWED_HOSTS + ['example.net', 'cache1.example.com', 'cache2.example.com']
tox.ini
23 23
  reusedb: REUSEDB=--reuse-db
24 24
  A2_TESTS=tests
25 25
  oldldap: A2_TESTS=tests/test_ldap.py
26
  PGPORT={env:PGPORT:}
26 27
usedevelop =
27 28
  coverage: True
28 29
  nocoverage: False
29
-