aboutsummaryrefslogtreecommitdiffstats
path: root/functest/tests/unit/ci
diff options
context:
space:
mode:
authorLinda Wang <wangwulin@huawei.com>2017-12-05 10:20:55 +0000
committerCédric Ollivier <cedric.ollivier@orange.com>2017-12-12 21:43:12 +0100
commit8f0134178d24b7b478beb22395c448cf76e381f2 (patch)
treec10a4d82cf2cce3465aa834956bc6dc16839dc2a /functest/tests/unit/ci
parent5ed771a9a0dbc09610ecc900c0c3e86edc08eee6 (diff)
All patching config files in memory
It adds the yaml content as Config attribute and allow patching it without modifying the file (and reimport constants or config). It also removes obsolete data in config_patch.yaml and moves several functions in the right modules (Config) JIRA: ARMBAND-334 Co-Authored-By: Cédric Ollivier <cedric.ollivier@orange.com> Change-Id: I5c9a574d3283828063154c977cdfbc2abfdc6777 Signed-off-by: Linda Wang <wangwulin@huawei.com> Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
Diffstat (limited to 'functest/tests/unit/ci')
-rw-r--r--functest/tests/unit/ci/test_run_tests.py50
1 files changed, 0 insertions, 50 deletions
diff --git a/functest/tests/unit/ci/test_run_tests.py b/functest/tests/unit/ci/test_run_tests.py
index b5af18c9..bc95f8f3 100644
--- a/functest/tests/unit/ci/test_run_tests.py
+++ b/functest/tests/unit/ci/test_run_tests.py
@@ -58,56 +58,6 @@ class RunTestsTesting(unittest.TestCase):
self.run_tests_parser = run_tests.RunTestsParser()
- self.config_file_yaml = {'general': {
- 'openstack': {
- 'image_name': 'test_image_name'}},
- 'results': {
- 'test_db_url': 'url1'}}
- self.config_file_patch_yaml = {'fdio': {'general': {
- 'openstack': {
- 'image_name':
- 'test_image_name_2'}}}}
- self.config_file_aarcg64_patch_yaml = {'os': {'general': {
- 'openstack': {'image_name': 'test_image_name_3'}}}}
-
- @mock.patch('functest.ci.run_tests.Runner.patch_file')
- def test_update_config_file_default(self, mock_patch):
- self.runner.update_config_file()
- mock_patch.assert_called()
-
- def test_patch_file_missing_file(self):
- patch_file_path = "unexisting_file"
- with self.assertRaises(IOError):
- self.runner.patch_file(patch_file_path)
-
- @mock.patch('functest.ci.run_tests.ft_utils.merge_dicts')
- @mock.patch('functest.ci.run_tests.ft_utils.get_functest_yaml')
- def test_patch_file_default(self, *mock_methods):
- CONST.__setattr__('DEPLOY_SCENARIO', 'os-nosdn-nofeature-noha')
- with mock.patch(
- 'six.moves.builtins.open', mock.mock_open()), mock.patch(
- 'functest.ci.run_tests.yaml.safe_load') as yaml1, mock.patch(
- 'functest.ci.run_tests.ft_utils.get_functest_yaml') as yaml2:
- yaml1.return_value = self.config_file_patch_yaml
- yaml2.return_value = self.config_file_yaml
- self.runner.patch_file(yaml1)
- mock_methods[1].assert_not_called()
- mock_methods[0].assert_not_called()
-
- @mock.patch('functest.ci.run_tests.ft_utils.merge_dicts')
- @mock.patch('functest.ci.run_tests.os.remove')
- def test_patch_file_match_scenario(self, *mock_methods):
- CONST.__setattr__('DEPLOY_SCENARIO', 'os-nosdn-fdio-noha')
- with mock.patch(
- 'six.moves.builtins.open', mock.mock_open()), mock.patch(
- 'functest.ci.run_tests.yaml.safe_load') as yaml1, mock.patch(
- 'functest.ci.run_tests.ft_utils.get_functest_yaml') as yaml2:
- yaml1.return_value = self.config_file_patch_yaml
- yaml2.return_value = self.config_file_yaml
- self.runner.patch_file(yaml2)
- mock_methods[1].assert_called()
- mock_methods[0].assert_called()
-
@mock.patch('functest.ci.run_tests.logger.error')
def test_source_rc_file_missing_file(self, mock_logger_error):
with mock.patch('functest.ci.run_tests.os.path.isfile',