From 65f9646eae531e52936f687d2c87fd46130e068e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vincent=20Fran=C3=A7oise?= Date: Tue, 17 Jan 2017 14:23:12 +0100 Subject: [PATCH] Use RPC cast() to be asynchronous Change-Id: I54814dc37a79eb06386923f946d85a67894c7646 --- watcher/applier/rpcapi.py | 2 +- watcher/decision_engine/rpcapi.py | 2 +- watcher/tests/applier/test_rpcapi.py | 4 ++-- watcher/tests/decision_engine/test_rpcapi.py | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/watcher/applier/rpcapi.py b/watcher/applier/rpcapi.py index fdfbacd10..6788dc6d8 100644 --- a/watcher/applier/rpcapi.py +++ b/watcher/applier/rpcapi.py @@ -36,7 +36,7 @@ class ApplierAPI(service.Service): if not utils.is_uuid_like(action_plan_uuid): raise exception.InvalidUuidOrName(name=action_plan_uuid) - return self.conductor_client.call( + self.conductor_client.cast( context, 'launch_action_plan', action_plan_uuid=action_plan_uuid) diff --git a/watcher/decision_engine/rpcapi.py b/watcher/decision_engine/rpcapi.py index 23deec603..f0e0e2a18 100644 --- a/watcher/decision_engine/rpcapi.py +++ b/watcher/decision_engine/rpcapi.py @@ -37,7 +37,7 @@ class DecisionEngineAPI(service.Service): if not utils.is_uuid_like(audit_uuid): raise exception.InvalidUuidOrName(name=audit_uuid) - return self.conductor_client.call( + self.conductor_client.cast( context, 'trigger_audit', audit_uuid=audit_uuid) diff --git a/watcher/tests/applier/test_rpcapi.py b/watcher/tests/applier/test_rpcapi.py index 306d85bad..80e221ca3 100644 --- a/watcher/tests/applier/test_rpcapi.py +++ b/watcher/tests/applier/test_rpcapi.py @@ -43,10 +43,10 @@ class TestApplierAPI(base.TestCase): api_version=rpcapi.ApplierAPI().API_VERSION) def test_execute_audit_without_error(self): - with mock.patch.object(om.RPCClient, 'call') as mock_call: + with mock.patch.object(om.RPCClient, 'cast') as mock_cast: action_plan_uuid = utils.generate_uuid() self.api.launch_action_plan(self.context, action_plan_uuid) - mock_call.assert_called_once_with( + mock_cast.assert_called_once_with( self.context, 'launch_action_plan', action_plan_uuid=action_plan_uuid) diff --git a/watcher/tests/decision_engine/test_rpcapi.py b/watcher/tests/decision_engine/test_rpcapi.py index e168cba48..61b9c2f93 100644 --- a/watcher/tests/decision_engine/test_rpcapi.py +++ b/watcher/tests/decision_engine/test_rpcapi.py @@ -44,8 +44,8 @@ class TestDecisionEngineAPI(base.TestCase): audit_uuid) def test_execute_audit_without_error(self): - with mock.patch.object(om.RPCClient, 'call') as mock_call: + with mock.patch.object(om.RPCClient, 'cast') as mock_cast: audit_uuid = utils.generate_uuid() self.api.trigger_audit(self.context, audit_uuid) - mock_call.assert_called_once_with( + mock_cast.assert_called_once_with( self.context, 'trigger_audit', audit_uuid=audit_uuid)