summaryrefslogtreecommitdiffstats
path: root/functest/tests
diff options
context:
space:
mode:
authorLinda Wang <wangwulin@huawei.com>2017-08-03 08:51:37 +0000
committerLinda Wang <wangwulin@huawei.com>2017-08-09 09:05:32 +0000
commit2826ab5703330d2438c15c9d56c8b978d5023e09 (patch)
treefed502b831b9f87528766a90caf0adfc0a1b8ffa /functest/tests
parentcd4716eb5fa3a12e256fba8faa75780b7398ff68 (diff)
Record the test cases passed in tempest
Also, convert the test cases recorded with string into list Change-Id: Ie3980a555b4042e6fe9706320d33d4ec4c06ea0c Signed-off-by: Linda Wang <wangwulin@huawei.com>
Diffstat (limited to 'functest/tests')
-rw-r--r--functest/tests/unit/openstack/refstack_client/test_refstack_client.py32
1 files changed, 32 insertions, 0 deletions
diff --git a/functest/tests/unit/openstack/refstack_client/test_refstack_client.py b/functest/tests/unit/openstack/refstack_client/test_refstack_client.py
index 51dbb6408..e4e3364d6 100644
--- a/functest/tests/unit/openstack/refstack_client/test_refstack_client.py
+++ b/functest/tests/unit/openstack/refstack_client/test_refstack_client.py
@@ -55,6 +55,38 @@ class OSRefstackClientTesting(unittest.TestCase):
refstackclient.run_defcore(config, testlist)
m.assert_any_call(cmd)
+ @mock.patch('functest.opnfv_tests.openstack.refstack_client.'
+ 'refstack_client.LOGGER.info')
+ @mock.patch('__builtin__.open', side_effect=Exception)
+ def test_parse_refstack_result_missing_log_file(self, mock_open,
+ mock_logger_info):
+ self.case_name = 'refstack_defcore'
+ self.result = 0
+ self.refstackclient.parse_refstack_result()
+ mock_logger_info.assert_called_once_with(
+ "Testcase %s success_rate is %s%%",
+ self.case_name, self.result)
+
+ def test_parse_refstack_result_default(self):
+ log_file = ('''
+ {0} tempest.api.compute [18.464988s] ... ok
+ {0} tempest.api.volume [0.230334s] ... FAILED
+ {0} tempest.api.network [1.265828s] ... SKIPPED:
+ Ran: 3 tests in 1259.0000 sec.
+ - Passed: 1
+ - Skipped: 1
+ - Failed: 1
+ ''')
+ self.details = {"tests": 3,
+ "failures": 1,
+ "success": [' tempest.api.compute [18.464988s]'],
+ "errors": [' tempest.api.volume [0.230334s]'],
+ "skipped": [' tempest.api.network [1.265828s]']}
+ with mock.patch('__builtin__.open',
+ mock.mock_open(read_data=log_file)):
+ self.refstackclient.parse_refstack_result()
+ self.assertEqual(self.refstackclient.details, self.details)
+
def _get_main_kwargs(self, key=None):
kwargs = {'config': self._config,
'testlist': self._testlist}