diff options
author | Chornyi, TarasX <tarasx.chornyi@intel.com> | 2018-05-29 17:59:49 +0300 |
---|---|---|
committer | Chornyi, TarasX <tarasx.chornyi@intel.com> | 2018-06-29 18:01:47 +0300 |
commit | 005358a39a87e42061dd5b344916c2ffe0475961 (patch) | |
tree | 847dee42251536f505076001b6ec5b9068fb60ba /yardstick/tests/unit/network_services/nfvi/test_resource.py | |
parent | 6f4db35421d258cebd6e01769037e5cd64115639 (diff) |
NFVI support for standalone, baremetal and heat contexts
JIRA: YARDSTICK-1257
Change-Id: I6733bd49ac91985e8f3d7722e6990e8733bb430e
Signed-off-by: Chornyi, TarasX <tarasx.chornyi@intel.com>
Diffstat (limited to 'yardstick/tests/unit/network_services/nfvi/test_resource.py')
-rw-r--r-- | yardstick/tests/unit/network_services/nfvi/test_resource.py | 31 |
1 files changed, 26 insertions, 5 deletions
diff --git a/yardstick/tests/unit/network_services/nfvi/test_resource.py b/yardstick/tests/unit/network_services/nfvi/test_resource.py index de9679456..c06658218 100644 --- a/yardstick/tests/unit/network_services/nfvi/test_resource.py +++ b/yardstick/tests/unit/network_services/nfvi/test_resource.py @@ -18,6 +18,7 @@ import mock import unittest from yardstick.common import exceptions +from yardstick.common.exceptions import ResourceCommandError from yardstick.network_services.nfvi.resource import ResourceProfile from yardstick.network_services.nfvi import resource, collectd @@ -139,18 +140,38 @@ class TestResourceProfile(unittest.TestCase): self.resource_profile._start_collectd(ssh_mock, "/opt/nsb_bin") ssh_mock.execute = mock.Mock(return_value=(1, "", "")) - self.assertIsNone(self.resource_profile._start_collectd(ssh_mock, - "/opt/nsb_bin")) + with self.assertRaises(ResourceCommandError): + self.resource_profile._start_collectd(ssh_mock, "/opt/nsb_bin") + + def test__reset_rabbitmq(self): + ssh_mock = mock.Mock() + ssh_mock.execute = mock.Mock(return_value=(1, "", "")) + with self.assertRaises(exceptions.ResourceCommandError): + self.resource_profile._reset_rabbitmq(ssh_mock) + + def test__check_rabbitmq_user(self): + ssh_mock = mock.Mock() + ssh_mock.execute = mock.Mock(return_value=(0, "title\nadmin\t[]", "")) + self.assertTrue(self.resource_profile._check_rabbitmq_user(ssh_mock)) + + def test__set_rabbitmq_admin_user(self): + ssh_mock = mock.Mock() + ssh_mock.execute = mock.Mock(return_value=(1, "", "")) + with self.assertRaises(exceptions.ResourceCommandError): + self.resource_profile._set_rabbitmq_admin_user(ssh_mock) def test__start_rabbitmq(self): ssh_mock = mock.Mock() - ssh_mock.execute = mock.Mock(return_value=(0, "RabbitMQ", "")) - self.assertIsNone(self.resource_profile._start_rabbitmq(ssh_mock)) + self.resource_profile._reset_rabbitmq = mock.Mock() + self.resource_profile._set_rabbitmq_admin_user = mock.Mock() - ssh_mock.execute = mock.Mock(return_value=(0, "", "")) + self.resource_profile._reset_mq_flag = True + ssh_mock.execute = mock.Mock(return_value=(1, "", "")) with self.assertRaises(exceptions.ResourceCommandError): self.resource_profile._start_rabbitmq(ssh_mock) + self.resource_profile._reset_mq_flag = False + self.resource_profile._check_rabbitmq_user = mock.Mock(return_value=False) ssh_mock.execute = mock.Mock(return_value=(1, "", "")) with self.assertRaises(exceptions.ResourceCommandError): self.resource_profile._start_rabbitmq(ssh_mock) |