Test failures in docker container

Bug #1773818 reported by Pavlukhin Max
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
neutron
Fix Released
Undecided
Slawek Kaplonski

Bug Description

There are no enough resources to create the pool of virtual machines sometimes. People use containers in this case.

There are two tests that fail in docker container:
http://paste.openstack.org/show/722171/

The main reason is that docker container is not a Virtual Machine, so it doesn't provide all of the architecture in the same way that a Virtual Machine might. The underlying infrastructure of docker containers is configured on the Host system, not within the container itself

These tests use brctl and sysctl. You can use --privileged flag ('docker run' command) for brctl. What about sysctl? You can use sysctl commands with docker-client. But you can not use it inside a container.

It would be very cool if the tests were fixed so that they work in docker containers.

Revision history for this message
Antonio Ojea (aojea) wrote :

Do you have an example of the Dockerfile you are using to run these tests?

description: updated
Revision history for this message
Pavlukhin Max (mpavlukhin) wrote :

Yes, of course

Antonio Ojea (aojea)
Changed in neutron:
assignee: nobody → Antonio Ojea (itsuugo)
status: New → In Progress
Revision history for this message
Antonio Ojea (aojea) wrote :

I'm able to run all unit tests now without any failure, I had to enable ipv6 in docker [1] and run the container with the following arguments:

# sudo docker run --sysctl net.ipv6.conf.all.disable_ipv6=0 --privileged bash

The problem was the sysctl call as you pointed out, but it turned out that it failed only with the ipv6 calls because of [2].

[1] https://docs.docker.com/config/daemon/ipv6/
[2] https://github.com/moby/moby/issues/32619

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Related fix proposed to neutron (master)

Related fix proposed to branch: master
Review: https://review.openstack.org/570871

Revision history for this message
YAMAMOTO Takashi (yamamoto) wrote :

brctl and sysctl should be mocked for unit tests.
otherwise, those test cases should be moved to functional tests.

Revision history for this message
Antonio Ojea (aojea) wrote :

yamamoto It seems that the problem is that the function disable_ipv6() [1] is not mocked.
Both tests work if you mock or remove the disable_ipv6() function, but I guess that the best approach is to remove it because it looks that since this patch [2] ipv6 is no longer disabled in the bridges.

[1] https://github.com/openstack/neutron/blob/9cb96b873e1aab05076a1e58144cda073140fbfc/neutron/tests/unit/agent/linux/test_bridge_lib.py#L70

[2] https://review.openstack.org/#/c/431619/

Changed in neutron:
assignee: Antonio Ojea (itsuugo) → Slawek Kaplonski (slaweq)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on neutron (master)

Change abandoned by Antonio Ojea (<email address hidden>) on branch: master
Review: https://review.openstack.org/571219
Reason: Duplicate https://review.openstack.org/#/c/570270/

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

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

commit 8930d33c71e394c1cfaa1b9ad5493c79d394cb40
Author: Slawek Kaplonski <email address hidden>
Date: Wed May 23 15:13:42 2018 -0700

    Fix UT BridgeLibTest when IPv6 is disabled

    There was missing mock of
    ipv6_utils.is_enabled_and_bind_by_default() in BridgeLibTest
    unit tests and that cause failing some of tests from this module
    when tests are running on host with disabled IPv6.
    Now it's mocked and tests are running properly and are
    testing what they should test.

    Closes-Bug: #1773818
    Change-Id: I9144450ce85e020c0e33c5214a2178acbbbf5f54

Changed in neutron:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on neutron (master)

Change abandoned by Antonio Ojea (<email address hidden>) on branch: master
Review: https://review.openstack.org/570871

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

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

tags: added: neutron-proactive-backport-potential
tags: added: neutron-easy-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/582630

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/582631

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

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

commit 45ae2e45c41c2418ebc58fbd0f2921ab662fd4c4
Author: Slawek Kaplonski <email address hidden>
Date: Wed May 23 15:13:42 2018 -0700

    Fix UT BridgeLibTest when IPv6 is disabled

    There was missing mock of
    ipv6_utils.is_enabled_and_bind_by_default() in BridgeLibTest
    unit tests and that cause failing some of tests from this module
    when tests are running on host with disabled IPv6.
    Now it's mocked and tests are running properly and are
    testing what they should test.

    Closes-Bug: #1773818
    Change-Id: I9144450ce85e020c0e33c5214a2178acbbbf5f54
    (cherry picked from commit 8930d33c71e394c1cfaa1b9ad5493c79d394cb40)

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

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

commit f001b273b7f3241a96d08c30c767abce621609cd
Author: Slawek Kaplonski <email address hidden>
Date: Wed May 23 15:13:42 2018 -0700

    Fix UT BridgeLibTest when IPv6 is disabled

    There was missing mock of
    ipv6_utils.is_enabled_and_bind_by_default() in BridgeLibTest
    unit tests and that cause failing some of tests from this module
    when tests are running on host with disabled IPv6.
    Now it's mocked and tests are running properly and are
    testing what they should test.

    Closes-Bug: #1773818
    Change-Id: I9144450ce85e020c0e33c5214a2178acbbbf5f54
    (cherry picked from commit 8930d33c71e394c1cfaa1b9ad5493c79d394cb40)

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

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

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

This issue was fixed in the openstack/neutron 11.0.6 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.