"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "aodh/tests/unit/test_coordination.py" between
aodh-14.0.0.tar.gz and aodh-15.0.0.tar.gz

About: OpenStack Aodh provides alarms and notifications based on metrics.
The "Zed" series (latest release).

test_coordination.py  (aodh-14.0.0):test_coordination.py  (aodh-15.0.0)
skipping to change at line 222 skipping to change at line 222
self._usage_simulation(*agents_kwargs) self._usage_simulation(*agents_kwargs)
@mock.patch.object(coordination.LOG, 'exception') @mock.patch.object(coordination.LOG, 'exception')
def test_coordination_backend_offline(self, mocked_exception): def test_coordination_backend_offline(self, mocked_exception):
agents = [dict(agent_id='agent1', agents = [dict(agent_id='agent1',
group_id='group', group_id='group',
all_resources=['res1', 'res2'], all_resources=['res1', 'res2'],
expected_resources=[], expected_resources=[],
coordinator_cls=MockToozCoordExceptionRaiser)] coordinator_cls=MockToozCoordExceptionRaiser)]
self._usage_simulation(*agents) self._usage_simulation(*agents)
called = [mock.call(u'Error connecting to coordination backend.'), called = [mock.call('Error connecting to coordination backend.'),
mock.call(u'Error getting group membership info from ' mock.call('Error getting group membership info from '
u'coordination backend.')] 'coordination backend.')]
self.assertEqual(called, mocked_exception.call_args_list) self.assertEqual(called, mocked_exception.call_args_list)
@mock.patch.object(coordination.LOG, 'exception') @mock.patch.object(coordination.LOG, 'exception')
@mock.patch.object(coordination.LOG, 'info') @mock.patch.object(coordination.LOG, 'info')
def test_reconnect(self, mock_info, mocked_exception): def test_reconnect(self, mock_info, mocked_exception):
coord = self._get_new_started_coordinator({}, 'a', coord = self._get_new_started_coordinator({}, 'a',
MockToozCoordExceptionRaiser) MockToozCoordExceptionRaiser)
with mock.patch('tooz.coordination.get_coordinator', with mock.patch('tooz.coordination.get_coordinator',
return_value=MockToozCoordExceptionRaiser('a', {})): return_value=MockToozCoordExceptionRaiser('a', {})):
coord.heartbeat() coord.heartbeat()
called = [mock.call(u'Error connecting to coordination backend.'), called = [mock.call('Error connecting to coordination backend.'),
mock.call(u'Error connecting to coordination backend.'), mock.call('Error connecting to coordination backend.'),
mock.call(u'Error sending a heartbeat to coordination ' mock.call('Error sending a heartbeat to coordination '
u'backend.')] 'backend.')]
self.assertEqual(called, mocked_exception.call_args_list) self.assertEqual(called, mocked_exception.call_args_list)
with mock.patch('tooz.coordination.get_coordinator', with mock.patch('tooz.coordination.get_coordinator',
return_value=MockToozCoordinator('a', {})): return_value=MockToozCoordinator('a', {})):
coord.heartbeat() coord.heartbeat()
mock_info.assert_called_with(u'Coordination backend started ' mock_info.assert_called_with('Coordination backend started '
u'successfully.') 'successfully.')
def test_group_id_none(self): def test_group_id_none(self):
coord = self._get_new_started_coordinator({}, 'a') coord = self._get_new_started_coordinator({}, 'a')
self.assertTrue(coord._coordinator.is_started) self.assertTrue(coord._coordinator.is_started)
with mock.patch.object(coord._coordinator, 'join_group') as mocked: with mock.patch.object(coord._coordinator, 'join_group') as mocked:
coord.join_group(None) coord.join_group(None)
self.assertEqual(0, mocked.call_count) self.assertEqual(0, mocked.call_count)
with mock.patch.object(coord._coordinator, 'leave_group') as mocked: with mock.patch.object(coord._coordinator, 'leave_group') as mocked:
coord.leave_group(None) coord.leave_group(None)
 End of changes. 3 change blocks. 
9 lines changed or deleted 9 lines changed or added

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