aboutsummaryrefslogtreecommitdiffstats
path: root/functest/tests/unit/openstack/tempest/test_tempest.py
diff options
context:
space:
mode:
authorCédric Ollivier <cedric.ollivier@orange.com>2018-06-22 14:35:53 +0200
committerCédric Ollivier <cedric.ollivier@orange.com>2018-06-22 19:06:18 +0200
commit9ef0bcbeb22ca70ff2ceb750c08fb24e46a9d0ea (patch)
treeb351c0d1bda3706a5ffde9aa3775fe1dae48f9c4 /functest/tests/unit/openstack/tempest/test_tempest.py
parentb2824f4dc2f32731667e2cf511635dc885d08be9 (diff)
Update tempest to inherit from VmReady1
It also copies tempest.conf due to side effects raised by Barbican plugins. Change-Id: Ie87680f5d2e68527a5a61aac302838afc339dde8 Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
Diffstat (limited to 'functest/tests/unit/openstack/tempest/test_tempest.py')
-rw-r--r--functest/tests/unit/openstack/tempest/test_tempest.py25
1 files changed, 8 insertions, 17 deletions
diff --git a/functest/tests/unit/openstack/tempest/test_tempest.py b/functest/tests/unit/openstack/tempest/test_tempest.py
index 9116100cd..2a1378572 100644
--- a/functest/tests/unit/openstack/tempest/test_tempest.py
+++ b/functest/tests/unit/openstack/tempest/test_tempest.py
@@ -57,7 +57,8 @@ class OSTempestTesting(unittest.TestCase):
self.assertTrue(
(msg % conf_utils.TEMPEST_CUSTOM) in context.exception)
- def test_gen_tl_cm_default(self):
+ @mock.patch('os.remove')
+ def test_gen_tl_cm_default(self, *args):
self.tempestcommon.mode = 'custom'
with mock.patch('functest.opnfv_tests.openstack.tempest.tempest.'
'shutil.copyfile') as mock_copyfile, \
@@ -65,9 +66,12 @@ class OSTempestTesting(unittest.TestCase):
'os.path.isfile', return_value=True):
self.tempestcommon.generate_test_list()
self.assertTrue(mock_copyfile.called)
+ args[0].assert_called_once_with('/etc/tempest.conf')
+ @mock.patch('os.remove')
+ @mock.patch('shutil.copyfile')
@mock.patch('subprocess.check_output')
- def _test_gen_tl_mode_default(self, mode, mock_exec=None):
+ def _test_gen_tl_mode_default(self, mode, *args):
self.tempestcommon.mode = mode
if self.tempestcommon.mode == 'smoke':
testr_mode = r"'^tempest\.(api|scenario).*\[.*\bsmoke\b.*\]$'"
@@ -79,7 +83,8 @@ class OSTempestTesting(unittest.TestCase):
cmd = "(cd {0}; stestr list {1} >{2} 2>/dev/null)".format(
verifier_repo_dir, testr_mode, self.tempestcommon.list)
self.tempestcommon.generate_test_list()
- mock_exec.assert_called_once_with(cmd, shell=True)
+ args[0].assert_called_once_with(cmd, shell=True)
+ args[2].assert_called_once_with('/etc/tempest.conf')
def test_gen_tl_smoke_mode(self):
self._test_gen_tl_mode_default('smoke')
@@ -185,8 +190,6 @@ class OSTempestTesting(unittest.TestCase):
'os.path.exists', return_value=False)
@mock.patch('functest.opnfv_tests.openstack.tempest.tempest.os.makedirs',
side_effect=Exception)
- @mock.patch('functest.opnfv_tests.openstack.tempest.tempest.'
- 'TempestResourcesManager.cleanup')
def test_run_makedirs_ko(self, *args):
# pylint: disable=unused-argument
self.assertEqual(self.tempestcommon.run(),
@@ -195,10 +198,6 @@ class OSTempestTesting(unittest.TestCase):
@mock.patch('functest.opnfv_tests.openstack.tempest.tempest.'
'os.path.exists', return_value=False)
@mock.patch('functest.opnfv_tests.openstack.tempest.tempest.os.makedirs')
- @mock.patch('functest.opnfv_tests.openstack.tempest.tempest.'
- 'TempestResourcesManager.create', side_effect=Exception)
- @mock.patch('functest.opnfv_tests.openstack.tempest.tempest.'
- 'TempestResourcesManager.cleanup')
def test_run_create_resources_ko(self, *args):
# pylint: disable=unused-argument
self.assertEqual(self.tempestcommon.run(),
@@ -208,10 +207,6 @@ class OSTempestTesting(unittest.TestCase):
'os.path.exists', return_value=False)
@mock.patch('functest.opnfv_tests.openstack.tempest.tempest.os.makedirs')
@mock.patch('functest.opnfv_tests.openstack.tempest.tempest.'
- 'TempestResourcesManager.create', return_value={})
- @mock.patch('functest.opnfv_tests.openstack.tempest.tempest.'
- 'TempestResourcesManager.cleanup')
- @mock.patch('functest.opnfv_tests.openstack.tempest.tempest.'
'TempestCommon.configure', side_effect=Exception)
def test_run_configure_tempest_ko(self, *args):
# pylint: disable=unused-argument
@@ -222,10 +217,6 @@ class OSTempestTesting(unittest.TestCase):
'os.path.exists', return_value=False)
@mock.patch('functest.opnfv_tests.openstack.tempest.tempest.os.makedirs')
@mock.patch('functest.opnfv_tests.openstack.tempest.tempest.'
- 'TempestResourcesManager.create', return_value={})
- @mock.patch('functest.opnfv_tests.openstack.tempest.tempest.'
- 'TempestResourcesManager.cleanup')
- @mock.patch('functest.opnfv_tests.openstack.tempest.tempest.'
'TempestCommon.configure')
def _test_run(self, status, *args):
# pylint: disable=unused-argument