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

[settings][tests] Fix shm path handling

Create the subfolder if it does not exist.
parent 0c53c6b6
......@@ -41,7 +41,11 @@ TEMPLATES[0]["OPTIONS"]["debug"] = DEBUG # noqa
ALLOWED_HOSTS = ["testserver"]
if platform.system() == "Linux":
database_name = "/dev/shm/beatweb/test.sqlite3" # nosec
shm_path = "/dev/shm/beatweb" # nosec
if not os.path.exists(shm_path):
os.makedirs(shm_path)
database_name = os.path.join(shm_path, "test.sqlite3")
else:
database_name = "test.sqlite3"
DATABASES["default"]["NAME"] = database_name # noqa
......@@ -65,7 +69,7 @@ LOGGING["loggers"]["beat.web.utils.management.commands"]["handlers"] = [ # noqa
BASE_DIR = os.path.dirname(os.path.abspath(__name__))
if platform.system() == "Linux":
default_prefix = "/dev/shm/beatweb/test_prefix" # nosec
default_prefix = os.path.join(shm_path, "test_prefix") # nosec
else:
default_prefix = os.path.realpath("./test_prefix")
PREFIX = os.environ.get("BEAT_TEST_PREFIX", default_prefix)
......
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