mirror of
https://github.com/ansible/awx.git
synced 2026-03-26 13:25:02 -02:30
Merge pull request #9536 from rooftopcellist/dev-db-test
consolidate conditional pytest sqlite3 db settings Reviewed-by: https://github.com/apps/softwarefactory-project-zuul
This commit is contained in:
@@ -21,13 +21,6 @@ from split_settings.tools import optional, include
|
|||||||
# Load default settings.
|
# Load default settings.
|
||||||
from .defaults import * # NOQA
|
from .defaults import * # NOQA
|
||||||
|
|
||||||
if "pytest" in sys.modules:
|
|
||||||
CACHES = {
|
|
||||||
'default': {
|
|
||||||
'BACKEND': 'django.core.cache.backends.locmem.LocMemCache',
|
|
||||||
'LOCATION': 'unique-{}'.format(str(uuid.uuid4())),
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
# awx-manage shell_plus --notebook
|
# awx-manage shell_plus --notebook
|
||||||
NOTEBOOK_ARGUMENTS = [
|
NOTEBOOK_ARGUMENTS = [
|
||||||
@@ -170,6 +163,27 @@ except ImportError:
|
|||||||
traceback.print_exc()
|
traceback.print_exc()
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
|
# Use SQLite for unit tests instead of PostgreSQL. If the lines below are
|
||||||
|
# commented out, Django will create the test_awx-dev database in PostgreSQL to
|
||||||
|
# run unit tests.
|
||||||
|
if "pytest" in sys.modules:
|
||||||
|
CACHES = {
|
||||||
|
'default': {
|
||||||
|
'BACKEND': 'django.core.cache.backends.locmem.LocMemCache',
|
||||||
|
'LOCATION': 'unique-{}'.format(str(uuid.uuid4())),
|
||||||
|
},
|
||||||
|
}
|
||||||
|
DATABASES = {
|
||||||
|
'default': {
|
||||||
|
'ENGINE': 'django.db.backends.sqlite3',
|
||||||
|
'NAME': os.path.join(BASE_DIR, 'awx.sqlite3'), # noqa
|
||||||
|
'TEST': {
|
||||||
|
# Test database cannot be :memory: for inventory tests.
|
||||||
|
'NAME': os.path.join(BASE_DIR, 'awx_test.sqlite3'), # noqa
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
CELERYBEAT_SCHEDULE.update({ # noqa
|
CELERYBEAT_SCHEDULE.update({ # noqa
|
||||||
'isolated_heartbeat': {
|
'isolated_heartbeat': {
|
||||||
|
|||||||
@@ -11,8 +11,6 @@
|
|||||||
###############################################################################
|
###############################################################################
|
||||||
# MISC PROJECT SETTINGS
|
# MISC PROJECT SETTINGS
|
||||||
###############################################################################
|
###############################################################################
|
||||||
import os
|
|
||||||
import sys
|
|
||||||
|
|
||||||
# Enable the following lines and install the browser extension to use Django debug toolbar
|
# Enable the following lines and install the browser extension to use Django debug toolbar
|
||||||
# if your deployment method is not VMWare of Docker-for-Mac you may
|
# if your deployment method is not VMWare of Docker-for-Mac you may
|
||||||
@@ -20,21 +18,6 @@ import sys
|
|||||||
# INTERNAL_IPS = ('172.19.0.1', '172.18.0.1', '192.168.100.1')
|
# INTERNAL_IPS = ('172.19.0.1', '172.18.0.1', '192.168.100.1')
|
||||||
# ALLOWED_HOSTS = ['*']
|
# ALLOWED_HOSTS = ['*']
|
||||||
|
|
||||||
# Use SQLite for unit tests instead of PostgreSQL. If the lines below are
|
|
||||||
# commented out, Django will create the test_awx-dev database in PostgreSQL to
|
|
||||||
# run unit tests.
|
|
||||||
if "pytest" in sys.modules:
|
|
||||||
DATABASES = {
|
|
||||||
'default': {
|
|
||||||
'ENGINE': 'django.db.backends.sqlite3',
|
|
||||||
'NAME': os.path.join(BASE_DIR, 'awx.sqlite3'),
|
|
||||||
'TEST': {
|
|
||||||
# Test database cannot be :memory: for inventory tests.
|
|
||||||
'NAME': os.path.join(BASE_DIR, 'awx_test.sqlite3'),
|
|
||||||
},
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
# Location for cross-development of inventory plugins
|
# Location for cross-development of inventory plugins
|
||||||
AWX_ANSIBLE_COLLECTIONS_PATHS = '/var/lib/awx/vendor/awx_ansible_collections'
|
AWX_ANSIBLE_COLLECTIONS_PATHS = '/var/lib/awx/vendor/awx_ansible_collections'
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user