Support multiple messages from introspect manageable
This updates the workflow wrapper to use the multiple message interface. Change-Id: If29cb791acb5a01629bf2a97767fbcb2299b154c Partial-Bug: #1646887
This commit is contained in:
@@ -640,6 +640,12 @@ class TestStartBaremetalIntrospectionBulk(fakes.TestBaremetal):
|
||||
"introspected_nodes": {},
|
||||
}
|
||||
|
||||
self.websocket.wait_for_messages.return_value = iter([{
|
||||
"status": "SUCCESS",
|
||||
"message": "Success",
|
||||
"introspected_nodes": {},
|
||||
}])
|
||||
|
||||
parsed_args = self.check_parser(self.cmd, [], [])
|
||||
self.cmd.take_action(parsed_args)
|
||||
|
||||
@@ -655,10 +661,10 @@ class TestStartBaremetalIntrospectionBulk(fakes.TestBaremetal):
|
||||
}
|
||||
)
|
||||
|
||||
self.websocket.wait_for_message.return_value = {
|
||||
self.websocket.wait_for_messages.return_value = iter([{
|
||||
"status": "ERROR",
|
||||
"message": "Failed",
|
||||
}
|
||||
}])
|
||||
|
||||
parsed_args = self.check_parser(self.cmd, [], [])
|
||||
|
||||
|
||||
@@ -252,8 +252,12 @@ class TestIntrospectNode(fakes.TestOvercloudNode):
|
||||
self.websocket.wait_for_message.return_value = {
|
||||
"status": "SUCCESS",
|
||||
"message": "Success",
|
||||
"introspected_nodes": {}
|
||||
}
|
||||
self.websocket.wait_for_messages.return_value = iter([{
|
||||
"status": "SUCCESS",
|
||||
"message": "Success",
|
||||
"introspected_nodes": {}
|
||||
}])
|
||||
|
||||
self.cmd.take_action(parsed_args)
|
||||
|
||||
|
||||
@@ -180,10 +180,11 @@ class TestBaremetalWorkflows(utils.TestCommand):
|
||||
|
||||
def test_introspect_manageable_nodes_success(self):
|
||||
|
||||
self.websocket.wait_for_message.return_value = {
|
||||
self.websocket.wait_for_messages.return_value = iter([{
|
||||
"execution": {"id": "IDID"},
|
||||
"status": "SUCCESS",
|
||||
"introspected_nodes": {},
|
||||
}
|
||||
}])
|
||||
|
||||
baremetal.introspect_manageable_nodes(
|
||||
self.app.client_manager, run_validations=False,
|
||||
@@ -198,10 +199,7 @@ class TestBaremetalWorkflows(utils.TestCommand):
|
||||
|
||||
def test_introspect_manageable_nodes_error(self):
|
||||
|
||||
self.websocket.wait_for_message.return_value = {
|
||||
"status": "FAIL",
|
||||
"message": "Failed"
|
||||
}
|
||||
self.websocket.wait_for_messages.return_value = self.message_failed
|
||||
|
||||
self.assertRaises(
|
||||
exceptions.IntrospectionError,
|
||||
@@ -219,11 +217,12 @@ class TestBaremetalWorkflows(utils.TestCommand):
|
||||
|
||||
def test_introspect_manageable_nodes_mixed_status(self):
|
||||
|
||||
self.websocket.wait_for_message.return_value = {
|
||||
self.websocket.wait_for_messages.return_value = iter([{
|
||||
"execution": {"id": "IDID"},
|
||||
"status": "SUCCESS",
|
||||
"introspected_nodes": {'node1': {'error': None},
|
||||
'node2': {'error': 'Error'}}
|
||||
}
|
||||
}])
|
||||
|
||||
self.assertRaises(
|
||||
exceptions.IntrospectionError,
|
||||
|
||||
@@ -153,7 +153,9 @@ def introspect_manageable_nodes(clients, **workflow_input):
|
||||
successful_node_uuids = set()
|
||||
|
||||
with tripleoclients.messaging_websocket(queue_name) as ws:
|
||||
payload = ws.wait_for_message(execution.id)
|
||||
for payload in base.wait_for_messages(workflow_client, ws, execution):
|
||||
if 'message' in payload:
|
||||
print(payload['message'])
|
||||
|
||||
if payload['status'] == 'SUCCESS':
|
||||
introspected_nodes = payload['introspected_nodes'] or {}
|
||||
|
||||
Reference in New Issue
Block a user