Merge "Ensure HM updates work as expected"

This commit is contained in:
Zuul 2022-11-25 17:05:05 +00:00 committed by Gerrit Code Review
commit 2f3a3443fd
2 changed files with 24 additions and 5 deletions

View File

@ -2472,11 +2472,15 @@ class OvnProviderHelper():
LOG.debug("Could not find LB with pool id %s", pool_id) LOG.debug("Could not find LB with pool id %s", pool_id)
return status return status
options = { options = {}
'interval': str(info['interval']), if info['interval']:
'timeout': str(info['timeout']), options['interval'] = str(info['interval'])
'success_count': str(info['success_count']), if info['timeout']:
'failure_count': str(info['failure_count'])} options['timeout'] = str(info['timeout'])
if info['success_count']:
options['success_count'] = str(info['success_count'])
if info['failure_count']:
options['failure_count'] = str(info['failure_count'])
commands = [] commands = []
commands.append( commands.append(

View File

@ -3675,6 +3675,21 @@ class TestOvnProviderHelper(ovn_base.TestOvnOctaviaBase):
self.assertEqual(status['healthmonitors'][0]['operating_status'], self.assertEqual(status['healthmonitors'][0]['operating_status'],
constants.ERROR) constants.ERROR)
@mock.patch.object(ovn_helper.OvnProviderHelper, '_find_ovn_lb_from_hm_id')
def test_hm_update_just_interval(self, folbfhi):
folbfhi.return_value = (self.ovn_hm, self.ovn_hm_lb)
self.health_monitor['interval'] = 3
self.helper.hm_update(self.health_monitor)
options = {
'interval': str(self.health_monitor['interval']),
'timeout': str(self.health_monitor['timeout']),
'success_count': str(self.health_monitor['success_count']),
'failure_count': str(self.health_monitor['failure_count'])}
self.helper.ovn_nbdb_api.db_set.assert_called_once_with(
'Load_Balancer_Health_Check',
self.ovn_hm.uuid,
('options', options))
def test_hm_delete(self): def test_hm_delete(self):
self.helper.ovn_nbdb_api.db_list_rows.return_value.\ self.helper.ovn_nbdb_api.db_list_rows.return_value.\
execute.return_value = [self.ovn_hm] execute.return_value = [self.ovn_hm]