Merge "Big Switch: Catch exceptions in watchdog thread"
This commit is contained in:
commit
c8edbe0694
@ -556,7 +556,11 @@ class ServerPool(object):
|
|||||||
# doesn't match, the backend will return a synchronization error
|
# doesn't match, the backend will return a synchronization error
|
||||||
# that will be handled by the rest_action.
|
# that will be handled by the rest_action.
|
||||||
eventlet.sleep(polling_interval)
|
eventlet.sleep(polling_interval)
|
||||||
self.rest_action('GET', HEALTH_PATH)
|
try:
|
||||||
|
self.rest_action('GET', HEALTH_PATH)
|
||||||
|
except Exception:
|
||||||
|
LOG.exception(_("Encountered an error checking controller "
|
||||||
|
"health."))
|
||||||
|
|
||||||
|
|
||||||
class HTTPSConnectionWithValidation(httplib.HTTPSConnection):
|
class HTTPSConnectionWithValidation(httplib.HTTPSConnection):
|
||||||
|
@ -83,17 +83,22 @@ class ServerManagerTests(test_rp.BigSwitchProxyPluginV2TestCase):
|
|||||||
mock.patch(
|
mock.patch(
|
||||||
SERVERMANAGER + '.ServerPool.rest_call',
|
SERVERMANAGER + '.ServerPool.rest_call',
|
||||||
side_effect=servermanager.RemoteRestError(
|
side_effect=servermanager.RemoteRestError(
|
||||||
reason='Failure to break loop'
|
reason='Failure to trigger except clause.'
|
||||||
)
|
)
|
||||||
|
),
|
||||||
|
mock.patch(
|
||||||
|
SERVERMANAGER + '.LOG.exception',
|
||||||
|
side_effect=KeyError('Failure to break loop')
|
||||||
)
|
)
|
||||||
) as (smock, rmock):
|
) as (smock, rmock, lmock):
|
||||||
# should return immediately without consistency capability
|
# should return immediately without consistency capability
|
||||||
pl.servers._consistency_watchdog()
|
pl.servers._consistency_watchdog()
|
||||||
self.assertFalse(smock.called)
|
self.assertFalse(smock.called)
|
||||||
pl.servers.capabilities = ['consistency']
|
pl.servers.capabilities = ['consistency']
|
||||||
self.assertRaises(servermanager.RemoteRestError,
|
self.assertRaises(KeyError,
|
||||||
pl.servers._consistency_watchdog)
|
pl.servers._consistency_watchdog)
|
||||||
rmock.assert_called_with('GET', '/health', '', {}, [], False)
|
rmock.assert_called_with('GET', '/health', '', {}, [], False)
|
||||||
|
self.assertEqual(1, len(lmock.mock_calls))
|
||||||
|
|
||||||
def test_consistency_hash_header(self):
|
def test_consistency_hash_header(self):
|
||||||
# mock HTTP class instead of rest_call so we can see headers
|
# mock HTTP class instead of rest_call so we can see headers
|
||||||
|
Loading…
x
Reference in New Issue
Block a user