def install_latest_mongodb(): try: from mongoctl.commands.misc.install import install_mongodb install_mongodb(None) except Exception, e: #print "Unable to install latest mongodb. Cause: '%s' " % e pass
def setUp(self): super(MongoctlTestBase, self).setUp() # _servers, _clusters are list of dicts # those will be passed as the --servers --clusters property self._servers = None self._clusters = None # set the config root to test conf root config.set_config_root(get_testing_conf_root()) # set the test dir env test_db_dir = get_test_db_dir() os.environ[MONGOCTL_TEST_DIR_ENV] = get_test_dir() os.environ[MONGOCTL_TEST_DBS_DIR_ENV] = test_db_dir os.environ[MONGOCTL_TEST_CONF_DIR_ENV] = get_testing_conf_root() # assure that the testing dir does not exist print "--- Creating test db directory %s " % test_db_dir if os.path.exists(test_db_dir): print ("Warning: %s already exists. Deleting and creating" " again..." % test_db_dir) shutil.rmtree(test_db_dir) os.makedirs(test_db_dir) # cleanup pids before running self.cleanup_test_server_pids() # install latest mongodb print "Installing latest stable MongoDB for testing..." # pass None to install latest version install_mongodb(mongodb_version=None)