From cc1d389f213510e0ffed0b0d0615cef5f896d9d7 Mon Sep 17 00:00:00 2001 From: Michael Youngstrom Date: Thu, 18 Oct 2018 15:50:00 -0400 Subject: [PATCH] Replace randint in db name with pid --- common/lib/xmodule/xmodule/modulestore/tests/utils.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/common/lib/xmodule/xmodule/modulestore/tests/utils.py b/common/lib/xmodule/xmodule/modulestore/tests/utils.py index e729143872..d9b964be97 100644 --- a/common/lib/xmodule/xmodule/modulestore/tests/utils.py +++ b/common/lib/xmodule/xmodule/modulestore/tests/utils.py @@ -1,6 +1,7 @@ """ Helper classes and methods for running modulestore tests without Django. """ +from uuid import uuid4 import io import os import random @@ -228,7 +229,7 @@ class MongoContentstoreBuilder(object): when the context closes. """ contentstore = MongoContentStore( - db='contentstore{}'.format(random.randint(0, 10000)), + db='contentstore{}'.format(THIS_UUID), collection='content', **COMMON_DOCSTORE_CONFIG ) @@ -286,7 +287,7 @@ class MongoModulestoreBuilder(StoreBuilderBase): all of its assets. """ doc_store_config = dict( - db='modulestore{}'.format(random.randint(0, 10000)), + db='modulestore{}'.format(THIS_UUID), collection='xmodule', asset_collection='asset_metadata', **COMMON_DOCSTORE_CONFIG @@ -334,7 +335,7 @@ class VersioningModulestoreBuilder(StoreBuilderBase): all of its assets. """ doc_store_config = dict( - db='modulestore{}'.format(random.randint(0, 10000)), + db='modulestore{}'.format(THIS_UUID), collection='split_module', **COMMON_DOCSTORE_CONFIG ) @@ -455,6 +456,8 @@ class MixedModulestoreBuilder(StoreBuilderBase): return store.db_connection.structures +THIS_UUID = uuid4().hex + COMMON_DOCSTORE_CONFIG = { 'host': MONGO_HOST, 'port': MONGO_PORT_NUM,