test_update_port_with_empty_data is failing

Bug #1839434 reported by Maciej Jozefczyk on 2019-08-08
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
networking-ovn
Undecided
Maciej Jozefczyk

Bug Description

Test:
networking_ovn.tests.unit.ml2.test_mech_driver.TestOVNMechanismDriverPortsV2.test_update_port_with_empty_data

is failing after merge: https://review.opendev.org/#/c/673486/

The difference between networking-ovn and neutron is that in neutron testclass TestOVNMechanismDriverPortsV2 is runned against:

neutron.tests.unit.plugins.ml2.drivers.mechanism_test.TestMechanismDriver

but in networking-ovn its runned against real mechanism driver:

networking_ovn.ml2.mech_driver.OVNMechanismDriver.

That ends with the difference between port objects that test validates:
https://github.com/openstack/neutron/blob/master/neutron/tests/unit/plugins/ml2/test_plugin.py#L1112

neutron.tests.unit.plugins.ml2.drivers.mechanism_test.TestMechanismDriver does nothing with the port:
https://github.com/openstack/neutron/blob/master/neutron/tests/unit/plugins/ml2/drivers/mechanism_test.py#L208

But networking-ovn modifies it.

The only difference between those two dicts is added network information:

(py27) stack@failing-gate:~/networking-ovn$ diff /tmp/1 /tmp/2
17,35d16
< 'network': {'admin_state_up': True,
< 'availability_zone_hints': [],
< 'availability_zones': [],
< 'description': u'',
< 'id': u'eea51b81-6005-48dd-ac0b-dd47d5b5d96a',
< 'ipv4_address_scope': None,
< 'ipv6_address_scope': None,
< 'mtu': 1450,
< 'name': u'net1',
< 'project_id': u'46f70361-ba71-4bd0-9769-3573fd227c4b',
< 'provider:network_type': u'geneve',
< 'provider:physical_network': None,
< 'provider:segmentation_id': 86,
< 'router:external': False,
< 'shared': False,
< 'status': u'ACTIVE',
< 'subnets': [u'145880da-7381-4af0-ac7a-73cb874148e6'],
< 'tenant_id': u'46f70361-ba71-4bd0-9769-3573fd227c4b',
< 'vlan_transparent': None},

Changed in networking-ovn:
assignee: nobody → Maciej Jozefczyk (maciej.jozefczyk)
status: New → In Progress

Change abandoned by Maciej Józefczyk (<email address hidden>) on branch: master
Review: https://review.opendev.org/675261

Reviewed: https://review.opendev.org/674574
Committed: https://git.openstack.org/cgit/openstack/networking-ovn/commit/?id=b2b5e89bca25570a757c62fc6e30277365dae456
Submitter: Zuul
Branch: master

commit b2b5e89bca25570a757c62fc6e30277365dae456
Author: Maciej Józefczyk <email address hidden>
Date: Thu Aug 8 12:25:13 2019 +0000

    Fix gateway blockers

    This patch squaches two commits:

    1) Do not modify passed by reference variables in mechanism_driver

    Test test_update_port_with_empty_data [0] from TestOVNMechanismDriverPortsV2
    class in neutron is runned agains:
    neutron.tests.unit.plugins.ml2.drivers.mechanism_test.TestMechanismDriver
    which in fact during update_port_postcommit() does nothing with
    the port, only validates it [1].

    In networking-ovn this test is runned against real mechanism driver:
    networking_ovn.ml2.mech_driver.OVNMechanismDriver. This ends with
    little difference - to port dict 'network' information is added
    during call of update_port_postcommit(). The port data itself
    remains the same.
    We shouldn't modify passed by reference variables there. So doing
    deepcopy on all provided data.

    Here comes also the question if this test inheritance is the
    right way.

    2) Add mock for _check_for_socket_ready

    Recently in new octavia-lib release driver-lib provides
    get methods for quering objects by its ids [2].
    We need to mock() socket communication in tests, otherwise
    all the tests fails blocking CI.

    [0] https://review.opendev.org/#/c/673486
    [1] https://github.com/openstack/neutron/blob/master/neutron/tests/unit/plugins/ml2/drivers/mechanism_test.py#L208
    [2] https://github.com/openstack/octavia-lib/commit/d700c00a90fd62b4f6cb9eb30ebe5f619dd6bfda

    Related-Bug: #1838977
    Closes-Bug: #1839434
    Change-Id: I1ad224960173fe896f6eb8049a188d9e82874068

Changed in networking-ovn:
status: In Progress → Fix Released

Reviewed: https://review.opendev.org/675602
Committed: https://git.openstack.org/cgit/openstack/networking-ovn/commit/?id=36bd132b409b82416cc49311099a8db7fbcbcda3
Submitter: Zuul
Branch: stable/stein

commit 36bd132b409b82416cc49311099a8db7fbcbcda3
Author: Maciej Józefczyk <email address hidden>
Date: Thu Aug 8 12:25:13 2019 +0000

    Do not modify passed by reference variables in mechanism_driver

    Test test_update_port_with_empty_data [0] from TestOVNMechanismDriverPortsV2
    class in neutron is runned agains:
    neutron.tests.unit.plugins.ml2.drivers.mechanism_test.TestMechanismDriver
    which in fact during update_port_postcommit() does nothing with
    the port, only validates it [1].

    In networking-ovn this test is runned against real mechanism driver:
    networking_ovn.ml2.mech_driver.OVNMechanismDriver. This ends with
    little difference - to port dict 'network' information is added
    during call of update_port_postcommit(). The port data itself
    remains the same.
    We shouldn't modify passed by reference variables there. So doing
    deepcopy on all provided data.

    Here comes also the question if this test inheritance is the
    right way.

    [0] https://review.opendev.org/#/c/673486
    [1] https://github.com/openstack/neutron/blob/master/neutron/tests/unit/plugins/ml2/drivers/mechanism_test.py#L208

    Closes-Bug: #1839434
    Change-Id: I1ad224960173fe896f6eb8049a188d9e82874068
    (cherry picked from commit b2b5e89bca25570a757c62fc6e30277365dae456)

tags: added: in-stable-stein

Reviewed: https://review.opendev.org/675607
Committed: https://git.openstack.org/cgit/openstack/networking-ovn/commit/?id=5b382bbfe75897697620b37ae5bc5de62fb087d6
Submitter: Zuul
Branch: stable/queens

commit 5b382bbfe75897697620b37ae5bc5de62fb087d6
Author: Maciej Józefczyk <email address hidden>
Date: Thu Aug 8 12:25:13 2019 +0000

    Do not modify passed by reference variables in mechanism_driver

    Test test_update_port_with_empty_data [0] from TestOVNMechanismDriverPortsV2
    class in neutron is runned agains:
    neutron.tests.unit.plugins.ml2.drivers.mechanism_test.TestMechanismDriver
    which in fact during update_port_postcommit() does nothing with
    the port, only validates it [1].

    In networking-ovn this test is runned against real mechanism driver:
    networking_ovn.ml2.mech_driver.OVNMechanismDriver. This ends with
    little difference - to port dict 'network' information is added
    during call of update_port_postcommit(). The port data itself
    remains the same.
    We shouldn't modify passed by reference variables there. So doing
    deepcopy on all provided data.

    Here comes also the question if this test inheritance is the
    right way.

    [0] https://review.opendev.org/#/c/673486
    [1] https://github.com/openstack/neutron/blob/master/neutron/tests/unit/plugins/ml2/drivers/mechanism_test.py#L208

    Closes-Bug: #1839434
    Change-Id: I1ad224960173fe896f6eb8049a188d9e82874068
    (cherry picked from commit b2b5e89bca25570a757c62fc6e30277365dae456)
    (cherry picked from commit 36bd132b409b82416cc49311099a8db7fbcbcda3)

tags: added: in-stable-queens

Reviewed: https://review.opendev.org/675603
Committed: https://git.openstack.org/cgit/openstack/networking-ovn/commit/?id=25d24f209663c0b35968c48c24120c45f79e2b31
Submitter: Zuul
Branch: stable/rocky

commit 25d24f209663c0b35968c48c24120c45f79e2b31
Author: Maciej Józefczyk <email address hidden>
Date: Thu Aug 8 12:25:13 2019 +0000

    Do not modify passed by reference variables in mechanism_driver

    Test test_update_port_with_empty_data [0] from TestOVNMechanismDriverPortsV2
    class in neutron is runned agains:
    neutron.tests.unit.plugins.ml2.drivers.mechanism_test.TestMechanismDriver
    which in fact during update_port_postcommit() does nothing with
    the port, only validates it [1].

    In networking-ovn this test is runned against real mechanism driver:
    networking_ovn.ml2.mech_driver.OVNMechanismDriver. This ends with
    little difference - to port dict 'network' information is added
    during call of update_port_postcommit(). The port data itself
    remains the same.
    We shouldn't modify passed by reference variables there. So doing
    deepcopy on all provided data.

    Here comes also the question if this test inheritance is the
    right way.

    [0] https://review.opendev.org/#/c/673486
    [1] https://github.com/openstack/neutron/blob/master/neutron/tests/unit/plugins/ml2/drivers/mechanism_test.py#L208

    Closes-Bug: #1839434
    Change-Id: I1ad224960173fe896f6eb8049a188d9e82874068
    (cherry picked from commit b2b5e89bca25570a757c62fc6e30277365dae456)
    (cherry picked from commit 36bd132b409b82416cc49311099a8db7fbcbcda3)

tags: added: in-stable-rocky
tags: added: networking-ovn-proactive-backport-potential

This issue was fixed in the openstack/networking-ovn 7.0.0.0b1 development milestone.

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers