Merge "[Functional] Fix expected number of the enqueue_state_change calls" into stable/ussuri
This commit is contained in:
commit
f30e405cee
|
@ -45,6 +45,8 @@ from neutron.tests.common import net_helpers
|
||||||
from neutron.tests.functional import base
|
from neutron.tests.functional import base
|
||||||
|
|
||||||
|
|
||||||
|
LOG = logging.getLogger(__name__)
|
||||||
|
|
||||||
_uuid = uuidutils.generate_uuid
|
_uuid = uuidutils.generate_uuid
|
||||||
|
|
||||||
OVS_INTERFACE_DRIVER = 'neutron.agent.linux.interface.OVSInterfaceDriver'
|
OVS_INTERFACE_DRIVER = 'neutron.agent.linux.interface.OVSInterfaceDriver'
|
||||||
|
@ -169,6 +171,7 @@ class L3AgentTestFramework(base.BaseSudoTestCase):
|
||||||
qos_policy_id=qos_policy_id)
|
qos_policy_id=qos_policy_id)
|
||||||
|
|
||||||
def change_router_state(self, router_id, state):
|
def change_router_state(self, router_id, state):
|
||||||
|
LOG.debug("Router %s state changed to '%s'", router_id, state)
|
||||||
ri = self.agent.router_info.get(router_id)
|
ri = self.agent.router_info.get(router_id)
|
||||||
if not ri:
|
if not ri:
|
||||||
self.fail('Router %s is not present in the L3 agent' % router_id)
|
self.fail('Router %s is not present in the L3 agent' % router_id)
|
||||||
|
|
|
@ -17,6 +17,7 @@ import copy
|
||||||
|
|
||||||
import mock
|
import mock
|
||||||
from neutron_lib import constants
|
from neutron_lib import constants
|
||||||
|
from oslo_log import log as logging
|
||||||
from oslo_utils import netutils
|
from oslo_utils import netutils
|
||||||
import testtools
|
import testtools
|
||||||
|
|
||||||
|
@ -29,6 +30,9 @@ from neutron.tests.common import net_helpers
|
||||||
from neutron.tests.functional.agent.l3 import framework
|
from neutron.tests.functional.agent.l3 import framework
|
||||||
|
|
||||||
|
|
||||||
|
LOG = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class L3HATestCase(framework.L3AgentTestFramework):
|
class L3HATestCase(framework.L3AgentTestFramework):
|
||||||
|
|
||||||
def test_ha_router_update_floatingip_statuses(self):
|
def test_ha_router_update_floatingip_statuses(self):
|
||||||
|
@ -46,11 +50,13 @@ class L3HATestCase(framework.L3AgentTestFramework):
|
||||||
self.fail_ha_router(router)
|
self.fail_ha_router(router)
|
||||||
common_utils.wait_until_true(lambda: router.ha_state == 'backup')
|
common_utils.wait_until_true(lambda: router.ha_state == 'backup')
|
||||||
|
|
||||||
common_utils.wait_until_true(lambda:
|
def enqueue_call_count_match():
|
||||||
(enqueue_mock.call_count == 3 or enqueue_mock.call_count == 4))
|
LOG.debug("enqueue_mock called %s times.", enqueue_mock.call_count)
|
||||||
|
return enqueue_mock.call_count in [2, 3]
|
||||||
|
|
||||||
|
common_utils.wait_until_true(enqueue_call_count_match)
|
||||||
calls = [args[0] for args in enqueue_mock.call_args_list]
|
calls = [args[0] for args in enqueue_mock.call_args_list]
|
||||||
self.assertEqual((router.router_id, 'backup'), calls[0])
|
self.assertEqual((router.router_id, 'master'), calls[-2])
|
||||||
self.assertEqual((router.router_id, 'master'), calls[1])
|
|
||||||
self.assertEqual((router.router_id, 'backup'), calls[-1])
|
self.assertEqual((router.router_id, 'backup'), calls[-1])
|
||||||
|
|
||||||
def _expected_rpc_report(self, expected):
|
def _expected_rpc_report(self, expected):
|
||||||
|
|
Loading…
Reference in New Issue