Commit 84201666 by Jeremy Bowman

PLAT-1597 Fix test mongo cleanup hostname in Docker devstack

parent 00ba9c70
......@@ -130,7 +130,7 @@ class Env(object):
}
# Mongo databases that will be dropped before/after the tests run
BOK_CHOY_MONGO_HOST = 'edx.devstack.mongo' if USING_DOCKER else 'localhost'
MONGO_HOST = 'edx.devstack.mongo' if USING_DOCKER else 'localhost'
BOK_CHOY_MONGO_DATABASE = "test"
BOK_CHOY_CACHE_HOST = 'edx.devstack.memcached' if USING_DOCKER else '0.0.0.0'
BOK_CHOY_CACHE = memcache.Client(['{}:11211'.format(BOK_CHOY_CACHE_HOST)], debug=0)
......
......@@ -124,7 +124,7 @@ def is_mongo_running():
"""
# The mongo command will connect to the service,
# failing with a non-zero exit code if it cannot connect.
output = os.popen('mongo --host {} --eval "print(\'running\')"'.format(Env.BOK_CHOY_MONGO_HOST)).read()
output = os.popen('mongo --host {} --eval "print(\'running\')"'.format(Env.MONGO_HOST)).read()
return output and "running" in output
......@@ -157,7 +157,7 @@ def clear_mongo():
"""
sh(
"mongo --host {} {} --eval 'db.dropDatabase()' > /dev/null".format(
Env.BOK_CHOY_MONGO_HOST,
Env.MONGO_HOST,
Env.BOK_CHOY_MONGO_DATABASE,
)
)
......
......@@ -13,7 +13,6 @@ from pavelib.utils.timer import timed
from bok_choy.browser import browser
MONGO_PORT_NUM = int(os.environ.get('EDXAPP_TEST_MONGO_PORT', '27017'))
MONGO_HOST = os.environ.get('EDXAPP_TEST_MONGO_HOST', 'localhost')
MINIMUM_FIREFOX_VERSION = 28.0
__test__ = False # do not collect
......@@ -70,7 +69,7 @@ def clean_mongo():
Clean mongo test databases
"""
sh("mongo {host}:{port} {repo_root}/scripts/delete-mongo-test-dbs.js".format(
host=MONGO_HOST,
host=Env.MONGO_HOST,
port=MONGO_PORT_NUM,
repo_root=Env.REPO_ROOT,
))
......
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