Unit tests using fake_port1 and fake_port2 global variables are flaky

Bug #1809643 reported by Antonio Ojea
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
neutron
Fix Released
High
Antonio Ojea

Bug Description

The unit test test_enable_dhcp_helper_enable_metadata_nonisolated_dist_network modifies the global variables fake_port1, fake_port2, creating flakiness on unit tests that use those variables when execured in environments with high concurrency.

How to reproduce:

Run unit tests on following patch https://review.openstack.org/#/c/626641 with the following commands:

source .tox/py27/bin/activate
stestr run --concurrency=12 --until-failure neutron.tests.unit.agent.dhcp.test_agent.TestDhcpAgentEventHandler

After several iterations, the test port_create_end fails. Debugging the failure you can see that the ports that fail are different than the configured in the global variables, they have been modified by test_enable_dhcp_helper_enable_metadata_nonisolated_dist_network

Reference: https://rbtcollins.wordpress.com/2015/12/02/diagnosing-flaky-tests/

Changed in neutron:
assignee: nobody → Antonio Ojea (itsuugo)
status: New → In Progress
Antonio Ojea (aojea)
description: updated
Changed in neutron:
importance: Undecided → High
Revision history for this message
Antonio Ojea (aojea) wrote :
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to neutron (master)

Reviewed: https://review.openstack.org/627087
Committed: https://git.openstack.org/cgit/openstack/neutron/commit/?id=e83e5618b7ca71fb96bf460922480b9808b431b6
Submitter: Zuul
Branch: master

commit e83e5618b7ca71fb96bf460922480b9808b431b6
Author: aojeagarcia <email address hidden>
Date: Sun Dec 23 23:43:38 2018 +0100

    Don't modify global variables in unit tests

    The unit test
    test_enable_dhcp_helper_enable_metadata_nonisolated_dist_network
    modifies the global variables fake_port1, fake_port2, creating flakiness
    on unit tests that use those variables when execured in environments
    with high concurrency.

    Creating a deepcopy of the variable avoid that those changes can be
    propagated to other unit tests.

    Closes-Bug: #1809643

    Change-Id: Idfd0e99739952baf4d7b545b406cd1b251deb5f8
    Signed-off-by: aojeagarcia <email address hidden>

Changed in neutron:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to neutron (stable/rocky)

Fix proposed to branch: stable/rocky
Review: https://review.openstack.org/627302

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to neutron (stable/pike)

Fix proposed to branch: stable/pike
Review: https://review.openstack.org/627303

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to neutron (stable/ocata)

Fix proposed to branch: stable/ocata
Review: https://review.openstack.org/627304

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to neutron (stable/rocky)

Reviewed: https://review.openstack.org/627302
Committed: https://git.openstack.org/cgit/openstack/neutron/commit/?id=684b10234ed60ca63e8f42ab3af682a8241456d6
Submitter: Zuul
Branch: stable/rocky

commit 684b10234ed60ca63e8f42ab3af682a8241456d6
Author: aojeagarcia <email address hidden>
Date: Sun Dec 23 23:43:38 2018 +0100

    Don't modify global variables in unit tests

    The unit test
    test_enable_dhcp_helper_enable_metadata_nonisolated_dist_network
    modifies the global variables fake_port1, fake_port2, creating flakiness
    on unit tests that use those variables when execured in environments
    with high concurrency.

    Creating a deepcopy of the variable avoid that those changes can be
    propagated to other unit tests.

    Closes-Bug: #1809643

    Change-Id: Idfd0e99739952baf4d7b545b406cd1b251deb5f8
    Signed-off-by: aojeagarcia <email address hidden>
    (cherry picked from commit e83e5618b7ca71fb96bf460922480b9808b431b6)

tags: added: in-stable-rocky
tags: added: neutron-proactive-backport-potential
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to neutron (stable/queens)

Fix proposed to branch: stable/queens
Review: https://review.openstack.org/630403

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to neutron (stable/ocata)

Reviewed: https://review.openstack.org/627304
Committed: https://git.openstack.org/cgit/openstack/neutron/commit/?id=4c07f8ad356023b93a22326e00b2eee1e95eae7a
Submitter: Zuul
Branch: stable/ocata

commit 4c07f8ad356023b93a22326e00b2eee1e95eae7a
Author: aojeagarcia <email address hidden>
Date: Sun Dec 23 23:43:38 2018 +0100

    Don't modify global variables in unit tests

    The unit test
    test_enable_dhcp_helper_enable_metadata_nonisolated_dist_network
    modifies the global variables fake_port1, fake_port2, creating flakiness
    on unit tests that use those variables when execured in environments
    with high concurrency.

    Creating a deepcopy of the variable avoid that those changes can be
    propagated to other unit tests.

    Closes-Bug: #1809643

    Change-Id: Idfd0e99739952baf4d7b545b406cd1b251deb5f8
    Signed-off-by: aojeagarcia <email address hidden>
    (cherry picked from commit e83e5618b7ca71fb96bf460922480b9808b431b6)

tags: added: in-stable-ocata
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to neutron (stable/queens)

Reviewed: https://review.openstack.org/630403
Committed: https://git.openstack.org/cgit/openstack/neutron/commit/?id=44441bee0b20e476284111efe03a416c198d9933
Submitter: Zuul
Branch: stable/queens

commit 44441bee0b20e476284111efe03a416c198d9933
Author: aojeagarcia <email address hidden>
Date: Sun Dec 23 23:43:38 2018 +0100

    Don't modify global variables in unit tests

    The unit test
    test_enable_dhcp_helper_enable_metadata_nonisolated_dist_network
    modifies the global variables fake_port1, fake_port2, creating flakiness
    on unit tests that use those variables when execured in environments
    with high concurrency.

    Creating a deepcopy of the variable avoid that those changes can be
    propagated to other unit tests.

    Closes-Bug: #1809643

    Change-Id: Idfd0e99739952baf4d7b545b406cd1b251deb5f8
    Signed-off-by: aojeagarcia <email address hidden>
    (cherry picked from commit e83e5618b7ca71fb96bf460922480b9808b431b6)

tags: added: in-stable-queens
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to neutron (stable/pike)

Reviewed: https://review.openstack.org/627303
Committed: https://git.openstack.org/cgit/openstack/neutron/commit/?id=dab82d56c4559a921ed801815c220812742a9c11
Submitter: Zuul
Branch: stable/pike

commit dab82d56c4559a921ed801815c220812742a9c11
Author: aojeagarcia <email address hidden>
Date: Sun Dec 23 23:43:38 2018 +0100

    Don't modify global variables in unit tests

    The unit test
    test_enable_dhcp_helper_enable_metadata_nonisolated_dist_network
    modifies the global variables fake_port1, fake_port2, creating flakiness
    on unit tests that use those variables when execured in environments
    with high concurrency.

    Creating a deepcopy of the variable avoid that those changes can be
    propagated to other unit tests.

    Closes-Bug: #1809643

    Change-Id: Idfd0e99739952baf4d7b545b406cd1b251deb5f8
    Signed-off-by: aojeagarcia <email address hidden>
    (cherry picked from commit e83e5618b7ca71fb96bf460922480b9808b431b6)

tags: added: in-stable-pike
tags: removed: neutron-proactive-backport-potential
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/neutron 14.0.0.0b2

This issue was fixed in the openstack/neutron 14.0.0.0b2 development milestone.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/neutron 11.0.7

This issue was fixed in the openstack/neutron 11.0.7 release.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/neutron 13.0.3

This issue was fixed in the openstack/neutron 13.0.3 release.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/neutron 12.0.6

This issue was fixed in the openstack/neutron 12.0.6 release.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/neutron ocata-eol

This issue was fixed in the openstack/neutron ocata-eol release.

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

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.