diff options
author | Jing Lu <lvjing5@huawei.com> | 2017-12-13 06:10:55 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@opnfv.org> | 2017-12-13 06:10:55 +0000 |
commit | 4f0b2293ce25d8311d352bc4f10708d6a1e00c79 (patch) | |
tree | db6fe8bf0fbecbde27650fb3051a3f08bf0b4d89 /tests/unit/benchmark | |
parent | 102e3528ba4d7b8c566c1304192c4036f2a94f8f (diff) | |
parent | c46f8d22a2307e550fe7d769e043e23d3114428a (diff) |
Merge "KVMFORNFV: Reverting LiveMigration changes" into stable/euphrates
Diffstat (limited to 'tests/unit/benchmark')
-rw-r--r-- | tests/unit/benchmark/scenarios/compute/test_qemumigrate.py | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/tests/unit/benchmark/scenarios/compute/test_qemumigrate.py b/tests/unit/benchmark/scenarios/compute/test_qemumigrate.py index f163f1914..1f0ff3c29 100644 --- a/tests/unit/benchmark/scenarios/compute/test_qemumigrate.py +++ b/tests/unit/benchmark/scenarios/compute/test_qemumigrate.py @@ -16,6 +16,7 @@ from __future__ import absolute_import import unittest import mock +from oslo_serialization import jsonutils from yardstick.benchmark.scenarios.compute import qemu_migrate @@ -83,7 +84,7 @@ class QemuMigrateTestCase(unittest.TestCase): mock_ssh.SSH.from_node().execute.return_value = (0, sample_output, '') q.run(result) - expected_result = {} + expected_result = jsonutils.loads(sample_output) self.assertEqual(result, expected_result) def test_qemu_migrate_successful_sla(self, mock_ssh): @@ -103,7 +104,7 @@ class QemuMigrateTestCase(unittest.TestCase): mock_ssh.SSH.from_node().execute.return_value = (0, sample_output, '') q.run(result) - expected_result = {} + expected_result = jsonutils.loads(sample_output) self.assertEqual(result, expected_result) def test_qemu_migrate_unsuccessful_sla_totaltime(self, mock_ssh): @@ -117,8 +118,7 @@ class QemuMigrateTestCase(unittest.TestCase): sample_output = '{"totaltime": 15, "downtime": 2, "setuptime": 1}' mock_ssh.SSH.from_node().execute.return_value = (0, sample_output, '') - with self.assertRaises(AssertionError): - q.run(result) + self.assertRaises(AssertionError, q.run, result) def test_qemu_migrate_unsuccessful_sla_downtime(self, mock_ssh): @@ -131,8 +131,7 @@ class QemuMigrateTestCase(unittest.TestCase): sample_output = '{"totaltime": 15, "downtime": 2, "setuptime": 1}' mock_ssh.SSH.from_node().execute.return_value = (0, sample_output, '') - with self.assertRaises(AssertionError): - q.run(result) + self.assertRaises(AssertionError, q.run, result) def test_qemu_migrate_unsuccessful_sla_setuptime(self, mock_ssh): @@ -145,8 +144,7 @@ class QemuMigrateTestCase(unittest.TestCase): sample_output = '{"totaltime": 15, "downtime": 2, "setuptime": 1}' mock_ssh.SSH.from_node().execute.return_value = (0, sample_output, '') - with self.assertRaises(AssertionError): - q.run(result) + self.assertRaises(AssertionError, q.run, result) def test_qemu_migrate_unsuccessful_script_error(self, mock_ssh): @@ -156,9 +154,10 @@ class QemuMigrateTestCase(unittest.TestCase): mock_ssh.SSH.from_node().execute.return_value = (0, '', '') q.setup() + mock_ssh.SSH.from_node().execute.return_value = (1, '', 'FOOBAR') - with self.assertRaises(RuntimeError): - q.run(result) + self.assertRaises(RuntimeError, q.run, result) + def main(): unittest.main() |