I have a django application that uses 2 database connections:
I solved this by changing the DATABASES.TEST
definition. I added the TEST['MIRROR'] = 'default'
to the mdm_db
database entry.
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.oracle',
'NAME': '(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=%s)(PORT=1521)))(CONNECT_DATA=(SID=%s)))'
% (get_env_variable('LIMS_MIGRATION_HOST'), get_env_variable('LIMS_MIGRATION_SID')),
'USER': 'LIMS_MIGRATION',
'PASSWORD': get_env_variable('LIMS_MIGRATION_PASSWORD'),
},
'mdm_db': {
'ENGINE': 'django.db.backends.oracle',
'NAME': '(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=GB3P)(PORT=1521)))'
'(CONNECT_DATA=(SID=GB3P)))',
'USER': 'MDM',
'PASSWORD': get_env_variable('MDM_DB_PASSWORD'),
'TEST': {
'MIRROR': 'default', # Added this setting
}
},
}
According to the documentation this option can be abused to skip database creation:
However, the replica database has been configured as a test mirror (using the MIRROR test setting), indicating that under testing, replica should be treated as a mirror of default.
When the test environment is configured, a test version of replica will not be created. Instead the connection to replica will be redirected to point at default.
Running my tests now skips creation of the second database.
Thanks for all the input!!