2018-11-12 18:20:46 +03:00
|
|
|
"""
|
|
|
|
This file contains django settings to run tests with runtests.py
|
|
|
|
"""
|
2021-07-08 10:27:35 +03:00
|
|
|
from os import environ
|
|
|
|
|
2018-11-12 18:20:46 +03:00
|
|
|
SECRET_KEY = 'fake-key'
|
|
|
|
|
|
|
|
DATABASES = {
|
|
|
|
'default': {
|
|
|
|
'ENGINE': 'django.db.backends.postgresql_psycopg2',
|
|
|
|
'NAME': 'test',
|
2021-07-08 10:27:35 +03:00
|
|
|
'USER': environ.get('PGUSER', 'test'),
|
|
|
|
'PASSWORD': environ.get('PGPASS', 'test'),
|
|
|
|
'HOST': environ.get('PGHOST', '127.0.0.1'),
|
|
|
|
'PORT': environ.get('PGPORT', 5432)
|
2018-11-20 15:24:15 +03:00
|
|
|
},
|
2019-01-10 15:02:58 +03:00
|
|
|
'secondary': {
|
|
|
|
'ENGINE': 'django.db.backends.postgresql_psycopg2',
|
|
|
|
'NAME': 'test2',
|
2021-07-08 10:27:35 +03:00
|
|
|
'USER': environ.get('PGUSER', 'test'),
|
|
|
|
'PASSWORD': environ.get('PGPASS', 'test'),
|
|
|
|
'HOST': environ.get('PGHOST', '127.0.0.1'),
|
|
|
|
'PORT': environ.get('PGPORT', 5432)
|
2019-01-10 15:02:58 +03:00
|
|
|
},
|
2018-11-20 15:24:15 +03:00
|
|
|
|
|
|
|
# I need separate connections for multiprocessing tests
|
2018-11-29 13:19:25 +03:00
|
|
|
'test_db': {
|
2018-11-20 15:24:15 +03:00
|
|
|
'ENGINE': 'django.db.backends.postgresql_psycopg2',
|
2018-11-29 13:19:25 +03:00
|
|
|
'NAME': 'test_test',
|
2021-07-08 10:27:35 +03:00
|
|
|
'USER': environ.get('PGUSER', 'test'),
|
|
|
|
'PASSWORD': environ.get('PGPASS', 'test'),
|
|
|
|
'HOST': environ.get('PGHOST', '127.0.0.1'),
|
|
|
|
'PORT': environ.get('PGPORT', 5432)
|
2018-11-20 15:24:15 +03:00
|
|
|
},
|
2018-11-12 18:20:46 +03:00
|
|
|
}
|
2021-07-08 10:27:35 +03:00
|
|
|
DEFAULT_AUTO_FIELD = 'django.db.models.AutoField'
|
2018-11-12 18:20:46 +03:00
|
|
|
|
|
|
|
LOGGING = {
|
|
|
|
'version': 1,
|
|
|
|
'handlers': {
|
|
|
|
'console': {
|
|
|
|
'class': 'logging.StreamHandler',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
'loggers': {
|
|
|
|
'django-clickhouse': {
|
|
|
|
'handlers': ['console'],
|
|
|
|
'level': 'DEBUG'
|
2018-11-16 11:14:40 +03:00
|
|
|
},
|
|
|
|
'infi.clickhouse-orm': {
|
|
|
|
'handlers': ['console'],
|
|
|
|
'level': 'INFO'
|
2018-11-12 18:20:46 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
INSTALLED_APPS = [
|
2018-11-14 10:52:01 +03:00
|
|
|
"src",
|
2021-10-01 15:38:10 +03:00
|
|
|
|
|
|
|
# This app is included with config in order to test all is working fine here
|
|
|
|
"tests.apps.UnitTestAppConfig"
|
2018-11-12 18:20:46 +03:00
|
|
|
]
|
|
|
|
|
2018-11-15 15:37:58 +03:00
|
|
|
CLICKHOUSE_DATABASES = {
|
|
|
|
'default': {
|
2021-07-08 10:27:35 +03:00
|
|
|
'db_url': environ.get('CLICK_HOUSE_HOST', 'http://localhost:8123/'),
|
2018-11-15 15:37:58 +03:00
|
|
|
'db_name': 'test',
|
|
|
|
'username': 'default',
|
|
|
|
'password': ''
|
2018-11-28 13:30:19 +03:00
|
|
|
},
|
|
|
|
'secondary': {
|
2021-07-08 10:27:35 +03:00
|
|
|
'db_url': environ.get('CLICK_HOUSE_HOST', 'http://localhost:8123/'),
|
2018-11-28 13:30:19 +03:00
|
|
|
'db_name': 'test_2',
|
|
|
|
'username': 'default',
|
|
|
|
'password': ''
|
2018-12-18 15:33:34 +03:00
|
|
|
},
|
|
|
|
'no_migrate': {
|
2021-07-08 10:27:35 +03:00
|
|
|
'db_url': environ.get('CLICK_HOUSE_HOST', 'http://localhost:8123/'),
|
2018-12-18 15:33:34 +03:00
|
|
|
'db_name': 'test_3',
|
|
|
|
'username': 'default',
|
|
|
|
'password': '',
|
|
|
|
'migrate': False
|
|
|
|
},
|
|
|
|
'readonly': {
|
2021-07-08 10:27:35 +03:00
|
|
|
'db_url': environ.get('CLICK_HOUSE_HOST', 'http://localhost:8123/'),
|
2018-12-18 15:33:34 +03:00
|
|
|
'db_name': 'test_3',
|
|
|
|
'username': 'default',
|
|
|
|
'password': '',
|
|
|
|
'readonly': True
|
2018-11-15 15:37:58 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-11-14 10:52:01 +03:00
|
|
|
CLICKHOUSE_SYNC_BATCH_SIZE = 5000
|
2018-11-15 15:37:58 +03:00
|
|
|
|
2018-11-14 10:52:01 +03:00
|
|
|
CLICKHOUSE_REDIS_CONFIG = {
|
2021-07-08 10:27:35 +03:00
|
|
|
'host': environ.get('REDIS_HOST', '127.0.0.1'),
|
|
|
|
'port': environ.get('REDIS_PORT', 6379),
|
2018-11-14 10:52:01 +03:00
|
|
|
'db': 8,
|
|
|
|
'socket_timeout': 10
|
|
|
|
}
|
2019-01-10 13:05:16 +03:00
|
|
|
|
|
|
|
DATABASE_ROUTERS = ['tests.routers.SecondaryRouter']
|