diff --git a/rally_openstack/hook/fault_injection.py b/rally_openstack/hook/fault_injection.py index b645f556..27643878 100644 --- a/rally_openstack/hook/fault_injection.py +++ b/rally_openstack/hook/fault_injection.py @@ -23,7 +23,7 @@ LOG = logging.getLogger(__name__) @hook.configure(name="fault_injection", platform="openstack") -class FaultInjectionHook(hook.Hook): +class FaultInjectionHook(hook.HookAction): """Performs fault injection using os-faults library. Configuration: @@ -58,9 +58,6 @@ class FaultInjectionHook(hook.Hook): def get_cloud_config(self): deployment = objects.Deployment.get(self.task["deployment_uuid"]) deployment_config = deployment["config"] - if deployment_config["type"] != "ExistingCloud": - return None - extra_config = deployment_config.get("extra", {}) return extra_config.get("cloud_config") diff --git a/tests/unit/hook/test_fault_injection.py b/tests/unit/hook/test_fault_injection.py index 2be9b8d5..bd612806 100644 --- a/tests/unit/hook/test_fault_injection.py +++ b/tests/unit/hook/test_fault_injection.py @@ -50,6 +50,7 @@ class FaultInjectionHookTestCase(test.TestCase): @mock.patch("rally.common.objects.Deployment.get") @mock.patch("rally.common.utils.Timer", side_effect=fakes.FakeTimer) def test_run(self, mock_timer, mock_deployment_get): + mock_deployment_get.return_value = {"config": {}} hook = fault_injection.FaultInjectionHook( self.task, {"action": "foo", "verify": True}, {"iteration": 1}) @@ -102,6 +103,7 @@ class FaultInjectionHookTestCase(test.TestCase): @mock.patch("rally.common.utils.Timer", side_effect=fakes.FakeTimer) def test_run_error(self, mock_timer, mock_connect, mock_human_api, mock_deployment_get): + mock_deployment_get.return_value = {"config": {}} injector_inst = mock_connect.return_value mock_human_api.side_effect = error.OSFException("foo error") hook = fault_injection.FaultInjectionHook(