diff options
author | Cédric Ollivier <cedric.ollivier@orange.com> | 2019-10-11 10:44:25 +0200 |
---|---|---|
committer | Cédric Ollivier <cedric.ollivier@orange.com> | 2019-10-11 18:57:23 +0200 |
commit | 89e6bfd0ed222596e36e0bfa39de94bb3ef8cffc (patch) | |
tree | 2d87c0c0a88016dedc3b845766bc9fed1f48197a /functest/tests/unit/openstack | |
parent | b450f6f87d3675aea0e278e9b2e92e920adb8406 (diff) |
Leverage on Rally task tags
It avoids parsing rally task outputs which may hang (subprocess
communicate) as seen in rally_full and rally_jobs.
It simply selects test names as tags.
Change-Id: I88b54a8f155e557f8a606fdbd7d86c1f4d5dae3b
Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
(cherry picked from commit 74df72ec294998787a8f0af5e2084db91ba0778b)
Diffstat (limited to 'functest/tests/unit/openstack')
-rw-r--r-- | functest/tests/unit/openstack/rally/test_rally.py | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/functest/tests/unit/openstack/rally/test_rally.py b/functest/tests/unit/openstack/rally/test_rally.py index c86799048..5ab82ecc4 100644 --- a/functest/tests/unit/openstack/rally/test_rally.py +++ b/functest/tests/unit/openstack/rally/test_rally.py @@ -103,15 +103,19 @@ class OSRallyTesting(unittest.TestCase): mock_method.assert_called() mock_os_makedirs.assert_called() - def test_get_task_id_default(self): - cmd_raw = b'Task 1: started' - self.assertEqual(self.rally_base.get_task_id(cmd_raw), - '1') - - def test_get_task_id_missing_id(self): - cmd_raw = b'' - self.assertEqual(self.rally_base.get_task_id(cmd_raw), - None) + @mock.patch('subprocess.check_output', return_value=b'1\n') + def test_get_task_id_default(self, *args): + tag = 'nova' + self.assertEqual(self.rally_base.get_task_id(tag), '1') + args[0].assert_called_with( + ['rally', 'task', 'list', '--tag', tag, '--uuids-only']) + + @mock.patch('subprocess.check_output', return_value=b'\n') + def test_get_task_id_missing_id(self, *args): + tag = 'nova' + self.assertEqual(self.rally_base.get_task_id(tag), '') + args[0].assert_called_with( + ['rally', 'task', 'list', '--tag', tag, '--uuids-only']) def test_task_succeed_fail(self): json_raw = json.dumps({}) |