Mock looping_call in metadata agent tests
Change-Id: Icb5146084730384bac1fb7d3176ce0cfcd565cc5 Closes-Bug: #1262089
This commit is contained in:
parent
c85a888098
commit
40b4f470dd
@ -308,7 +308,10 @@ class TestUnixDomainMetadataProxy(base.BaseTestCase):
|
||||
super(TestUnixDomainMetadataProxy, self).setUp()
|
||||
self.cfg_p = mock.patch.object(agent, 'cfg')
|
||||
self.cfg = self.cfg_p.start()
|
||||
self.addCleanup(self.cfg_p.stop)
|
||||
looping_call_p = mock.patch(
|
||||
'neutron.openstack.common.loopingcall.FixedIntervalLoopingCall')
|
||||
self.looping_mock = looping_call_p.start()
|
||||
self.addCleanup(mock.patch.stopall)
|
||||
self.cfg.CONF.metadata_proxy_socket = '/the/path'
|
||||
|
||||
def test_init_doesnot_exists(self):
|
||||
@ -393,12 +396,10 @@ class TestUnixDomainMetadataProxy(base.BaseTestCase):
|
||||
)
|
||||
|
||||
def test_init_state_reporting(self):
|
||||
with mock.patch('neutron.openstack.common.loopingcall.'
|
||||
'FixedIntervalLoopingCall') as loop_call:
|
||||
with mock.patch('os.makedirs'):
|
||||
proxy = agent.UnixDomainMetadataProxy(mock.Mock())
|
||||
loop_call.assert_called_once_with(proxy._report_state)
|
||||
loop_call.return_value.start.assert_called_once_with(
|
||||
self.looping_mock.assert_called_once_with(proxy._report_state)
|
||||
self.looping_mock.return_value.start.assert_called_once_with(
|
||||
interval=mock.ANY)
|
||||
|
||||
def test_report_state(self):
|
||||
|
Loading…
Reference in New Issue
Block a user