"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "ironic/tests/unit/drivers/modules/test_agent_client.py" between
ironic-17.0.2.tar.gz and ironic-17.0.3.tar.gz

About: OpenStack Ironic (Optional Service: Bare-Metal Provisioning) aims to provision bare metal machines instead of virtual machines, forked from the Nova baremetal driver.
The "Wallaby" series (latest release).

test_agent_client.py  (ironic-17.0.2):test_agent_client.py  (ironic-17.0.3)
skipping to change at line 190 skipping to change at line 190
'command %(method)s. Error: %(error)s' % 'command %(method)s. Error: %(error)s' %
{'method': method, 'node': self.node.uuid, {'method': method, 'node': self.node.uuid,
'error': error}, str(e)) 'error': error}, str(e))
self.client.session.post.assert_called_with( self.client.session.post.assert_called_with(
url, url,
data=mock.ANY, data=mock.ANY,
params={'wait': 'false'}, params={'wait': 'false'},
timeout=60, timeout=60,
verify=True) verify=True)
self.assertEqual(3, self.client.session.post.call_count) self.assertEqual(3, self.client.session.post.call_count)
self.assertTrue(self.client.session.get.called)
def test__command_fail_connect_no_command_running(self):
error = 'Boom'
self.client.session.post.side_effect = requests.ConnectionError(error)
self.client.session.get.return_value.json.return_value = {
'commands': []
}
method = 'foo.bar'
params = {}
url = self.client._get_command_url(self.node)
self.client._get_command_body(method, params)
e = self.assertRaises(exception.AgentConnectionFailed,
self.client._command,
self.node, method, params)
self.assertEqual('Connection to agent failed: Failed to connect to '
'the agent running on node %(node)s for invoking '
'command %(method)s. Error: %(error)s' %
{'method': method, 'node': self.node.uuid,
'error': error}, str(e))
self.client.session.post.assert_called_with(
url,
data=mock.ANY,
params={'wait': 'false'},
timeout=60,
verify=True)
self.assertEqual(3, self.client.session.post.call_count)
self.assertTrue(self.client.session.get.called)
def test__command_fail_connect_wrong_command_running(self):
error = 'Boom'
self.client.session.post.side_effect = requests.ConnectionError(error)
self.client.session.get.return_value.json.return_value = {
'commands': [
{'command_name': 'meow', 'command_status': 'RUNNING'},
]
}
method = 'foo.bar'
params = {}
url = self.client._get_command_url(self.node)
self.client._get_command_body(method, params)
e = self.assertRaises(exception.AgentConnectionFailed,
self.client._command,
self.node, method, params)
self.assertEqual('Connection to agent failed: Failed to connect to '
'the agent running on node %(node)s for invoking '
'command %(method)s. Error: %(error)s' %
{'method': method, 'node': self.node.uuid,
'error': error}, str(e))
self.client.session.post.assert_called_with(
url,
data=mock.ANY,
params={'wait': 'false'},
timeout=60,
verify=True)
self.assertEqual(3, self.client.session.post.call_count)
self.assertTrue(self.client.session.get.called)
def test__command_fail_connect_command_not_running(self):
error = 'Boom'
self.client.session.post.side_effect = requests.ConnectionError(error)
self.client.session.get.return_value.json.return_value = {
'commands': [
{'command_name': 'bar', 'command_status': 'FINISHED'},
]
}
method = 'foo.bar'
params = {}
url = self.client._get_command_url(self.node)
self.client._get_command_body(method, params)
e = self.assertRaises(exception.AgentConnectionFailed,
self.client._command,
self.node, method, params)
self.assertEqual('Connection to agent failed: Failed to connect to '
'the agent running on node %(node)s for invoking '
'command %(method)s. Error: %(error)s' %
{'method': method, 'node': self.node.uuid,
'error': error}, str(e))
self.client.session.post.assert_called_with(
url,
data=mock.ANY,
params={'wait': 'false'},
timeout=60,
verify=True)
self.assertEqual(3, self.client.session.post.call_count)
self.assertTrue(self.client.session.get.called)
def test__command_fail_connect_command_is_running(self):
error = 'Boom'
self.client.session.post.side_effect = requests.ConnectionError(error)
self.client.session.get.return_value.json.return_value = {
'commands': [
{'command_name': 'bar', 'command_status': 'RUNNING'},
]
}
method = 'foo.bar'
params = {}
url = self.client._get_command_url(self.node)
self.client._get_command_body(method, params)
result = self.client._command(self.node, method, params)
self.assertEqual({'command_name': 'bar', 'command_status': 'RUNNING'},
result)
self.client.session.post.assert_called_once_with(
url,
data=mock.ANY,
params={'wait': 'false'},
timeout=60,
verify=True)
self.assertTrue(self.client.session.get.called)
def test__command_error_code(self): def test__command_error_code(self):
response_text = {"faultstring": "you dun goofd"} response_text = {"faultstring": "you dun goofd"}
self.client.session.post.return_value = MockResponse( self.client.session.post.return_value = MockResponse(
response_text, status_code=http_client.BAD_REQUEST) response_text, status_code=http_client.BAD_REQUEST)
method = 'standby.run_image' method = 'standby.run_image'
image_info = {'image_id': 'test_image'} image_info = {'image_id': 'test_image'}
params = {'image_info': image_info} params = {'image_info': image_info}
url = self.client._get_command_url(self.node) url = self.client._get_command_url(self.node)
 End of changes. 1 change blocks. 
0 lines changed or deleted 117 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)