Avoid fullstack QoS tests to handle other test ports

In order to isolate the concurrent execution of fullstack QoS tests,
the function QosAgentExtension._process_reset_port() is mocked to
avoid any port reset created by other test.

Change-Id: Ib78098387e90b6c315d3e969004f5786ace8696e
Closes-Bug: #1824138
(cherry picked from commit 1c1f176882)
This commit is contained in:
Rodolfo Alonso Hernandez 2019-04-11 09:37:46 +00:00
parent fe6a777181
commit dc3a314674
1 changed files with 10 additions and 2 deletions

View File

@ -19,6 +19,7 @@ import mock
from oslo_config import cfg
from neutron.agent.common import ovs_lib
from neutron.agent.l2.extensions import qos as qos_extension
from neutron.services.trunk.drivers.openvswitch.agent \
import driver as trunk_driver
from neutron.tests.common.agents import ovs_agent
@ -38,14 +39,21 @@ def monkeypatch_init_handler():
trunk_driver.init_handler = new_init_handler
def monkeypatch_qos():
mock.patch.object(ovs_lib.OVSBridge, 'clear_minimum_bandwidth_qos').start()
if "qos" in cfg.CONF.service_plugins:
mock.patch.object(qos_extension.QosAgentExtension,
'_process_reset_port').start()
def main():
# TODO(slaweq): this monkepatch will not be necessary when
# https://review.openstack.org/#/c/506722/ will be merged and ovsdb-server
# ovs-vswitchd processes for each test will be isolated in separate
# namespace
monkeypatch_init_handler()
with mock.patch.object(ovs_lib.OVSBridge, 'clear_minimum_bandwidth_qos'):
ovs_agent.main()
monkeypatch_qos()
ovs_agent.main()
if __name__ == "__main__":