Project

General

Profile

0001-use-BRANCH_NAME-for-naming-test-databases-31337.patch

Benjamin Dauvergne, 12 Mar 2019 07:51 PM

Download (3.37 KB)

View differences:

Subject: [PATCH 1/2] use BRANCH_NAME for naming test databases (#31337)

 tests_authentic/settings.py   | 5 +++++
 tests_multipublik/settings.py | 5 +++++
 tests_multitenant/settings.py | 5 +++++
 tests_passerelle/settings.py  | 5 +++++
 tox.ini                       | 1 +
 5 files changed, 21 insertions(+)
tests_authentic/settings.py
12 12
with patch.object(builtin, 'file', mock_open(read_data='xxx')):
13 13
    execfile(os.environ['DEBIAN_CONFIG_COMMON'])
14 14

  
15
BRANCH_NAME = os.environ.get("BRANCH_NAME", "").replace('/', '-')
16
DATABASES['default']['TEST'] = {
17
    'NAME': DATABASES['default']['NAME'] + '-%s' % BRANCH_NAME,
18
}
19

  
15 20
# Avoid conflic with real tenants
16 21
# that might exist in /var/lib/authentic2_multitenant/tenants
17 22
TENANT_BASE = '/that/path/does/not/exist'
tests_multipublik/settings.py
11 11
with patch.object(builtin, 'file', mock_open(read_data='xxx')):
12 12
    execfile(os.path.join(os.path.dirname(__file__), '../debian/debian_config_common.py'))
13 13

  
14
BRANCH_NAME = os.environ.get("BRANCH_NAME", "").replace('/', '-')
15
DATABASES['default']['TEST'] = {
16
    'NAME': DATABASES['default']['NAME'] + '-%s' % BRANCH_NAME,
17
}
18

  
14 19
CACHES = {
15 20
    'default': {
16 21
        'BACKEND': 'hobo.multitenant.cache.TenantCache',
tests_multitenant/settings.py
43 43
with patch.object(builtin, 'file', mock_open(read_data='xxx')):
44 44
    execfile(os.path.join(os.path.dirname(__file__), '../debian/debian_config_common.py'))
45 45

  
46
BRANCH_NAME = os.environ.get("BRANCH_NAME", "").replace('/', '-')
47
DATABASES['default']['TEST'] = {
48
    'NAME': DATABASES['default']['NAME'] + '-%s' % BRANCH_NAME,
49
}
50

  
46 51
TENANT_APPS = ('django.contrib.auth', 'django.contrib.sessions', 'django.contrib.contenttypes',
47 52
               'hobo.agent.common', 'mellon')
48 53

  
tests_passerelle/settings.py
14 14
with patch.object(builtin, 'file', mock_open(read_data='xxx')):
15 15
    execfile(os.environ['DEBIAN_CONFIG_COMMON'])
16 16

  
17
BRANCH_NAME = os.environ.get("BRANCH_NAME", "").replace('/', '-')
18
DATABASES['default']['TEST'] = {
19
    'NAME': DATABASES['default']['NAME'] + '-%s' % BRANCH_NAME,
20
}
21

  
17 22
# Avoid conflic with real tenants
18 23
# that might exist in /var/lib/passerelle/tenants
19 24
TENANT_BASE = '/that/path/does/not/exist'
tox.ini
12 12
	/bin/mv
13 13
usedevelop = True
14 14
setenv =
15
	BRANCH_NAME={env:BRANCH_NAME:}
15 16
	hobo: DJANGO_SETTINGS_MODULE=hobo.settings
16 17
	hobo: HOBO_SETTINGS_FILE=tests/settings.py
17 18
	multitenant: PYTHONPATH=tests_multitenant
18
-