diff options
author | Amrith Kumar <amrith@tesora.com> | 2015-09-14 16:56:09 +0000 |
---|---|---|
committer | Amrith Kumar <amrith@tesora.com> | 2015-09-14 18:34:35 +0000 |
commit | c1cecebdf654cf0e36c8c75ca0c3dbfdfb66e869 (patch) | |
tree | 02e271cd20cba629a5154182c4d46fd275b5a731 | |
parent | 0c813d068b0d69fd141697378d5854389d22e282 (diff) | |
download | trove-c1cecebdf654cf0e36c8c75ca0c3dbfdfb66e869.tar.gz |
Properly patch _init_overrides_dir in MongoDB
Since most of us don't have MongoDB installed on our
desktop/development environment, tox tests will fail because some
config paths for Mongo aren't available.
The change proposed here is merely to mock the _init_overrides_dir
properly in changes that would otherwise stub their toes on this.
It is my understanding that this issue was introduced in Change-Id:
Iaca9cc9e3ce1e6521839062fc9458c1b987f9464 which sought to address bug
1485158.
The reason this problem occurs on my machine (and likely on other
developers workstation) is that I don't have MongoDB installed. The
reason this doesn't impact the gate is that those machines have
MongoDB installed (for ceiliometer).
Change-Id: I0f3d24b95a7d2ef1e23a0f1fd8f60bc496261f70
Closes-Bug: #1495573
-rw-r--r-- | trove/tests/unittests/backup/test_backupagent.py | 4 | ||||
-rw-r--r-- | trove/tests/unittests/guestagent/test_backups.py | 5 |
2 files changed, 8 insertions, 1 deletions
diff --git a/trove/tests/unittests/backup/test_backupagent.py b/trove/tests/unittests/backup/test_backupagent.py index 2d802f4f..ed543934 100644 --- a/trove/tests/unittests/backup/test_backupagent.py +++ b/trove/tests/unittests/backup/test_backupagent.py @@ -26,6 +26,7 @@ from trove.common import utils from trove.conductor import api as conductor_api from trove.guestagent.backup import backupagent from trove.guestagent.common import configuration +from trove.guestagent.datastore.experimental.mongodb.service import MongoDBApp from trove.guestagent.strategies.backup.base import BackupRunner from trove.guestagent.strategies.backup.base import UnknownBackupType from trove.guestagent.strategies.backup.experimental import couchbase_impl @@ -241,7 +242,8 @@ class BackupAgentTest(trove_testtools.TestCase): self.assertIsNotNone(cbbackup.manifest) self.assertIn('gz.enc', cbbackup.manifest) - def test_backup_impl_MongoDump(self): + @mock.patch.object(MongoDBApp, '_init_overrides_dir') + def test_backup_impl_MongoDump(self, _): netutils.get_my_ipv4 = Mock(return_value="1.1.1.1") utils.execute_with_timeout = Mock(return_value=None) mongodump = mongo_impl.MongoDump('mongodump', extra_opts='') diff --git a/trove/tests/unittests/guestagent/test_backups.py b/trove/tests/unittests/guestagent/test_backups.py index e12709c4..44204c21 100644 --- a/trove/tests/unittests/guestagent/test_backups.py +++ b/trove/tests/unittests/guestagent/test_backups.py @@ -518,6 +518,10 @@ class MongodbBackupTests(trove_testtools.TestCase): super(MongodbBackupTests, self).setUp() self.exec_timeout_patch = patch.object(utils, 'execute_with_timeout') self.exec_timeout_patch.start() + self.mongodb_init_overrides_dir_patch = patch.object( + MongoDBApp, + '_init_overrides_dir') + self.mongodb_init_overrides_dir_patch.start() self.backup_runner = utils.import_class( BACKUP_MONGODUMP_CLS) self.backup_runner_patch = patch.multiple( @@ -528,6 +532,7 @@ class MongodbBackupTests(trove_testtools.TestCase): super(MongodbBackupTests, self).tearDown() self.backup_runner_patch.stop() self.exec_timeout_patch.stop() + self.mongodb_init_overrides_dir_patch.stop() def test_backup_success(self): backup_runner_mocks = self.backup_runner_patch.start() |