Commit b77ce437 authored by Samuel GAIST's avatar Samuel GAIST Committed by André Anjos

[settings] Use /dev/shm for test data(db/prefix)

This allows a nice speedup of the test database and prefix
creation.
parent b23d57a2
......@@ -15,6 +15,7 @@ sphinx/
.mr.developer.cfg
.coverage
*.sql3
*.sqlite3
.DS_Store
beat/web/settings/settings.py
src/
......
......@@ -27,6 +27,6 @@
# Django settings for tests on the CI server
from .test import *
from .test import * # noqa
RUNNING_ON_CI = True
......@@ -26,48 +26,58 @@
###############################################################################
# Django settings for tests
import os
import platform
import sys
from .settings import *
from .settings import * # noqa
TEST_CONFIGURATION = True
RUNNING_ON_CI = False
DEBUG = False
TEMPLATES[0]['OPTIONS']['debug'] = DEBUG
TEMPLATES[0]["OPTIONS"]["debug"] = DEBUG # noqa
ALLOWED_HOSTS = [
'testserver',
]
ALLOWED_HOSTS = ["testserver"]
DATABASES['default']['NAME'] = 'test.sql3'
DATABASES['default']['TEST'] = {'NAME': DATABASES['default']['NAME']}
DATABASES['default']['OPTIONS']['timeout'] = 30
if platform.system() == "Linux":
database_name = "/dev/shm/beatweb/test.sqlite3" # nosec
else:
database_name = "test.sqlite3"
DATABASES["default"]["NAME"] = database_name # noqa
DATABASES["default"]["TEST"] = {"NAME": DATABASES["default"]["NAME"]} # noqa
DATABASES["default"]["OPTIONS"]["timeout"] = 30 # noqa
DATABASES["default"]["ATOMIC_REQUESTS"] = True # noqa
import sys
if 'beat.cmdline' in sys.argv:
if "beat.cmdline" in sys.argv:
# make it in-memory for cmdline app tests
DATABASES['default']['NAME'] = ':memory:'
DATABASES["default"]["NAME"] = ":memory:" # noqa
LOGGING['handlers']['console']['level'] = 'DEBUG'
LOGGING['loggers']['beat.core']['handlers'] = ['discard']
LOGGING['loggers']['beat.web']['handlers'] = ['discard']
LOGGING['loggers']['beat.web.utils.management.commands']['handlers'] = ['discard']
LOGGING["handlers"]["console"]["level"] = "DEBUG" # noqa
LOGGING["loggers"]["beat.core"]["handlers"] = ["discard"] # noqa
LOGGING["loggers"]["beat.web"]["handlers"] = ["discard"] # noqa
LOGGING["loggers"]["beat.web.utils.management.commands"]["handlers"] = [ # noqa
"discard"
]
BASE_DIR = os.path.dirname(os.path.abspath(__name__))
PREFIX = os.environ.get('BEAT_TEST_PREFIX', os.path.realpath('./test_prefix'))
ALGORITHMS_ROOT = os.path.join(PREFIX, 'algorithms')
PLOTTERS_ROOT = os.path.join(PREFIX, 'plotters')
LIBRARIES_ROOT = os.path.join(PREFIX, 'libraries')
DATABASES_ROOT = os.path.join(PREFIX, 'databases')
DATAFORMATS_ROOT = os.path.join(PREFIX, 'dataformats')
TOOLCHAINS_ROOT = os.path.join(PREFIX, 'toolchains')
EXPERIMENTS_ROOT = os.path.join(PREFIX, 'experiments')
CACHE_ROOT = os.path.join(PREFIX, 'cache')
if platform.system() == "Linux":
default_prefix = "/dev/shm/beatweb/test_prefix" # nosec
else:
default_prefix = os.path.realpath("./test_prefix")
PREFIX = os.environ.get("BEAT_TEST_PREFIX", default_prefix)
ALGORITHMS_ROOT = os.path.join(PREFIX, "algorithms")
PLOTTERS_ROOT = os.path.join(PREFIX, "plotters")
LIBRARIES_ROOT = os.path.join(PREFIX, "libraries")
DATABASES_ROOT = os.path.join(PREFIX, "databases")
DATAFORMATS_ROOT = os.path.join(PREFIX, "dataformats")
TOOLCHAINS_ROOT = os.path.join(PREFIX, "toolchains")
EXPERIMENTS_ROOT = os.path.join(PREFIX, "experiments")
CACHE_ROOT = os.path.join(PREFIX, "cache")
LOCAL_SCHEDULER_VERBOSITY = None
LOCAL_SCHEDULER_USE_DOCKER = False
# To speed-up tests, don't put this in production
PASSWORD_HASHERS = [
'django.contrib.auth.hashers.MD5PasswordHasher',
]
PASSWORD_HASHERS = ["django.contrib.auth.hashers.MD5PasswordHasher"]
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment