Skip to content

Commit 693c6e8

Browse files
Zuulopenstack-gerrit
authored andcommitted
Merge "tests: call correct assert_* methods"
2 parents bd1137a + 41e7c43 commit 693c6e8

File tree

1 file changed

+21
-12
lines changed

1 file changed

+21
-12
lines changed

ovn_octavia_provider/tests/unit/test_helper.py

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4347,16 +4347,16 @@ def test__get_port_from_info_port_not_without_match_address(self, net_cli):
43474347
self.assertEqual(result_port, fake_port)
43484348
self.assertIsNone(result_subnet)
43494349
net_cli.get_port.assert_called_once_with(port_id)
4350-
net_cli.get_subnet.not_called()
4350+
net_cli.get_subnet.assert_not_called()
43514351

43524352
@mock.patch('ovn_octavia_provider.common.clients.get_neutron_client')
43534353
def test__get_port_from_info_port_insufficient_data(self, net_cli):
43544354
result_port, result_subnet = self.helper._get_port_from_info(
43554355
net_cli, None, None, None)
43564356
self.assertIsNone(result_port)
43574357
self.assertIsNone(result_subnet)
4358-
net_cli.get_port.not_called()
4359-
net_cli.get_subnet.not_called()
4358+
net_cli.get_port.assert_not_called()
4359+
net_cli.get_subnet.assert_not_called()
43604360

43614361
def test__get_vip_port_from_loadbalancer_id(self):
43624362
fake_lb = fakes.FakeLB(
@@ -4530,21 +4530,30 @@ def test_hm_create_no_vip_port(self, folbpi):
45304530
vip = ''
45314531
options = {'interval': '6',
45324532
'timeout': '7',
4533-
'failure_count': '5',
4534-
'success_count': '3'}
4533+
'success_count': '3',
4534+
'failure_count': '5'}
45354535
self.ovn_hm.external_ids.pop(ovn_const.LB_EXT_IDS_HM_KEY)
4536-
external_ids = {
4536+
external_ids_vip = {
45374537
ovn_const.LB_EXT_IDS_HM_KEY: self.healthmonitor_id,
45384538
ovn_const.LB_EXT_IDS_HM_POOL_KEY: self.pool_id,
45394539
ovn_const.LB_EXT_IDS_HM_VIP: self.ovn_hm_lb.external_ids.get(
45404540
ovn_const.LB_EXT_IDS_VIP_KEY)}
4541-
kwargs = {'vip': vip,
4542-
'options': options,
4543-
'external_ids': external_ids}
4541+
external_ids_fip = {
4542+
ovn_const.LB_EXT_IDS_HM_KEY: self.healthmonitor_id,
4543+
ovn_const.LB_EXT_IDS_HM_POOL_KEY: self.pool_id,
4544+
ovn_const.LB_EXT_IDS_HM_VIP: self.ovn_hm_lb.external_ids.get(
4545+
ovn_const.LB_EXT_IDS_VIP_FIP_KEY)}
4546+
kwargs_first = {'vip': vip,
4547+
'options': options,
4548+
'external_ids': external_ids_vip}
4549+
kwargs_second = {'vip': vip,
4550+
'options': options,
4551+
'external_ids': external_ids_fip}
45444552
expected_lbhc_calls = [
4545-
mock.call('Load_Balancer_Health_Check', **kwargs),
4546-
mock.call('Load_Balancer_Health_Check', **kwargs)]
4547-
self.helper.ovn_nbdb_api.db_create.has_calls(expected_lbhc_calls)
4553+
mock.call('Load_Balancer_Health_Check', **kwargs_first),
4554+
mock.call('Load_Balancer_Health_Check', **kwargs_second)]
4555+
self.helper.ovn_nbdb_api.db_create.assert_has_calls(
4556+
expected_lbhc_calls)
45484557
self.assertEqual(self.helper.ovn_nbdb_api.db_add.call_count, 2)
45494558

45504559
@mock.patch.object(ovn_helper.OvnProviderHelper, '_find_ovn_lb_by_pool_id')

0 commit comments

Comments
 (0)