tests: truncate database name to 63 characters
This commit is contained in:
parent
d5b56715f3
commit
1d712335ef
|
@ -19,6 +19,6 @@ HOBO_MANAGER_HOMEPAGE_URL_VAR = 'portal_agent_url'
|
|||
DATABASES = {
|
||||
'default': {
|
||||
'ENGINE': os.environ.get('DB_ENGINE', 'django.db.backends.sqlite3'),
|
||||
'TEST': {'NAME': 'hobo-test-%s' % os.environ.get("BRANCH_NAME", "").replace('/', '-')[:63],},
|
||||
'TEST': {'NAME': ('hobo-test-%s' % os.environ.get("BRANCH_NAME", "").replace('/', '-'))[:63],},
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@ with patch.object(builtins, 'open', mock_open(read_data=b'xxx')):
|
|||
|
||||
BRANCH_NAME = os.environ.get("BRANCH_NAME", "").replace('/', '-')
|
||||
DATABASES['default']['TEST'] = {
|
||||
'NAME': DATABASES['default']['NAME'] + '-%s' % BRANCH_NAME,
|
||||
'NAME': (DATABASES['default']['NAME'] + '-%s' % BRANCH_NAME)[:63],
|
||||
}
|
||||
|
||||
# Avoid conflic with real tenants
|
||||
|
|
|
@ -18,7 +18,7 @@ with patch.object(builtins, 'open', mock_open(read_data=b'xxx')):
|
|||
|
||||
BRANCH_NAME = os.environ.get("BRANCH_NAME", "").replace('/', '-')
|
||||
DATABASES['default']['TEST'] = {
|
||||
'NAME': DATABASES['default']['NAME'] + '-%s' % BRANCH_NAME,
|
||||
'NAME': (DATABASES['default']['NAME'] + '-%s' % BRANCH_NAME)[:63],
|
||||
}
|
||||
|
||||
CACHES = {
|
||||
|
|
|
@ -50,7 +50,7 @@ with patch.object(builtins, 'open', mock_open(read_data=b'xxx')):
|
|||
|
||||
BRANCH_NAME = os.environ.get("BRANCH_NAME", "").replace('/', '-')
|
||||
DATABASES['default']['TEST'] = {
|
||||
'NAME': DATABASES['default']['NAME'] + '-%s' % BRANCH_NAME,
|
||||
'NAME': (DATABASES['default']['NAME'] + '-%s' % BRANCH_NAME)[:63],
|
||||
}
|
||||
|
||||
TENANT_APPS = ('django.contrib.auth', 'django.contrib.sessions', 'django.contrib.contenttypes',
|
||||
|
|
|
@ -18,7 +18,7 @@ with patch.object(builtins, 'open', mock_open(read_data=b'xxx')):
|
|||
|
||||
BRANCH_NAME = os.environ.get("BRANCH_NAME", "").replace('/', '-')
|
||||
DATABASES['default']['TEST'] = {
|
||||
'NAME': DATABASES['default']['NAME'] + '-%s' % BRANCH_NAME,
|
||||
'NAME': (DATABASES['default']['NAME'] + '-%s' % BRANCH_NAME)[:63],
|
||||
}
|
||||
|
||||
# Avoid conflic with real tenants
|
||||
|
|
|
@ -1,11 +1,14 @@
|
|||
import os
|
||||
import tempfile
|
||||
|
||||
TENANT_BASE = tempfile.mkdtemp('hobo-tenant-base')
|
||||
TENANT_MODEL = 'multitenant.Tenant'
|
||||
MIDDLEWARE = ('hobo.multitenant.middleware.TenantMiddleware',) + MIDDLEWARE
|
||||
BRANCH_NAME = os.environ.get("BRANCH_NAME", "").replace('/', '_').replace('-', '_').encode('ascii', 'ignore').decode()
|
||||
DATABASES = {
|
||||
'default': {
|
||||
'ENGINE': 'tenant_schemas.postgresql_backend',
|
||||
'NAME': 'test_hobo',
|
||||
'TEST': {'NAME': ('hobo_test_schemas_' + BRANCH_NAME)[:63]},
|
||||
}
|
||||
}
|
||||
DATABASE_ROUTERS = ('tenant_schemas.routers.TenantSyncRouter',)
|
||||
|
|
Loading…
Reference in New Issue