Merge pull request #18795 from edx/youngstrom/try-unique-db

Use a unique name for test mongo dbs
This commit is contained in:
Michael Youngstrom
2018-08-17 11:23:15 -04:00
committed by GitHub
4 changed files with 10 additions and 9 deletions

View File

@@ -85,10 +85,10 @@ update_module_store_settings(
'fs_root': TEST_ROOT / "data",
},
doc_store_settings={
'db': 'test_xmodule',
'db': 'test_xmodule_{}'.format(THIS_UUID),
'host': MONGO_HOST,
'port': MONGO_PORT_NUM,
'collection': 'test_modulestore{0}'.format(THIS_UUID),
'collection': 'test_modulestore',
},
)

View File

@@ -8,6 +8,7 @@ from path import Path as path
import random
import re
import unittest
import os
import uuid
import ddt
@@ -53,9 +54,9 @@ class SplitModuleTest(unittest.TestCase):
# Snippets of what would be in the django settings envs file
DOC_STORE_CONFIG = {
'host': MONGO_HOST,
'db': 'test_xmodule',
'db': 'test_xmodule_{0}'.format(os.getpid()),
'port': MONGO_PORT_NUM,
'collection': 'modulestore{0}'.format(uuid.uuid4().hex[:5]),
'collection': 'modulestore',
}
modulestore_options = {
'default_class': 'xmodule.raw_module.RawDescriptor',

View File

@@ -2,7 +2,7 @@ import datetime
import random
import unittest
import uuid
import os
import mock
import pytest
@@ -35,7 +35,8 @@ class SplitWMongoCourseBootstrapper(unittest.TestCase):
db_config = {
'host': MONGO_HOST,
'port': MONGO_PORT_NUM,
'db': 'test_xmodule',
'db': 'test_xmodule_{}'.format(os.getpid()),
'collection': 'modulestore'
}
modulestore_options = {
@@ -48,8 +49,6 @@ class SplitWMongoCourseBootstrapper(unittest.TestCase):
split_course_key = CourseLocator('test_org', 'test_course', 'runid', branch=ModuleStoreEnum.BranchName.draft)
def setUp(self):
self.db_config['collection'] = 'modulestore{0}'.format(uuid.uuid4().hex[:5])
self.user_id = random.getrandbits(32)
super(SplitWMongoCourseBootstrapper, self).setUp()
self.split_mongo = SplitMongoModuleStore(

View File

@@ -9,6 +9,7 @@ from path import Path as path
from shutil import rmtree
from tempfile import mkdtemp
from unittest import TestCase
import os
from xmodule.x_module import XModuleMixin
from xmodule.contentstore.mongo import MongoContentStore
@@ -87,7 +88,7 @@ class MixedSplitTestCase(TestCase):
DOC_STORE_CONFIG = {
'host': MONGO_HOST,
'port': MONGO_PORT_NUM,
'db': 'test_mongo_libs',
'db': 'test_mongo_libs_{0}'.format(os.getpid()),
'collection': 'modulestore',
'asset_collection': 'assetstore',
}