BigSwitch: Fix rest call in consistency watchdog
Fixes the rest call in the consistency watchdog in the BigSwitch plugin that was causing it to raise an exception. Closes-Bug: #1289138 Change-Id: Id4dff993426573be6984eb1e8f6ef2aabfff0779
This commit is contained in:
parent
546f7719b0
commit
671b476dcf
@ -552,7 +552,7 @@ class ServerPool(object):
|
||||
# doesn't match, the backend will return a synchronization error
|
||||
# that will be handled by the rest_call.
|
||||
time.sleep(polling_interval)
|
||||
self.servers.rest_call('GET', HEALTH_PATH)
|
||||
self.rest_call('GET', HEALTH_PATH)
|
||||
|
||||
|
||||
class HTTPSConnectionWithValidation(httplib.HTTPSConnection):
|
||||
|
@ -14,6 +14,7 @@
|
||||
#
|
||||
# @author: Kevin Benton, kevin.benton@bigswitch.com
|
||||
#
|
||||
from contextlib import nested
|
||||
import mock
|
||||
from oslo.config import cfg
|
||||
|
||||
@ -21,6 +22,8 @@ from neutron.manager import NeutronManager
|
||||
from neutron.plugins.bigswitch import servermanager
|
||||
from neutron.tests.unit.bigswitch import test_restproxy_plugin as test_rp
|
||||
|
||||
SERVERMANAGER = 'neutron.plugins.bigswitch.servermanager'
|
||||
|
||||
|
||||
class ServerManagerTests(test_rp.BigSwitchProxyPluginV2TestCase):
|
||||
|
||||
@ -45,3 +48,23 @@ class ServerManagerTests(test_rp.BigSwitchProxyPluginV2TestCase):
|
||||
*('example.org', 443)
|
||||
)
|
||||
sslgetmock.assert_has_calls([mock.call(('example.org', 443))])
|
||||
|
||||
def test_consistency_watchdog(self):
|
||||
pl = NeutronManager.get_plugin()
|
||||
pl.servers.capabilities = []
|
||||
self.watch_p.stop()
|
||||
with nested(
|
||||
mock.patch('time.sleep'),
|
||||
mock.patch(
|
||||
SERVERMANAGER + '.ServerPool.rest_call',
|
||||
side_effect=servermanager.RemoteRestError(
|
||||
reason='Failure to break loop'
|
||||
)
|
||||
)
|
||||
) as (smock, rmock):
|
||||
# should return immediately without consistency capability
|
||||
pl.servers._consistency_watchdog()
|
||||
self.assertFalse(smock.called)
|
||||
pl.servers.capabilities = ['consistency']
|
||||
self.assertRaises(servermanager.RemoteRestError,
|
||||
pl.servers._consistency_watchdog)
|
||||
|
Loading…
x
Reference in New Issue
Block a user