From 6906c4017fb1df525fd5b6c7eefb88e5c8b67ceb Mon Sep 17 00:00:00 2001 From: Slawek Kaplonski Date: Thu, 28 Jun 2018 12:22:28 +0200 Subject: [PATCH] [Unit tests] Skip TestWSGIServer with IPv6 if no IPv6 enabled Test test_wsgi.TestWSGIServer.test_start_random_port_with_ipv6 is trying to spawn server and bind it to local IPv6 address. In case when this test is run on host with disabled support for IPv6 it shouldn't fails but should be skipped. This patch adds such skip if IPv6 is disabled on host. Change-Id: I3f7fc20a063757db78fa44c62312a9fcf96a3071 --- neutron/tests/unit/test_wsgi.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/neutron/tests/unit/test_wsgi.py b/neutron/tests/unit/test_wsgi.py index c7e60c274ea..e7fdb1e1d6b 100644 --- a/neutron/tests/unit/test_wsgi.py +++ b/neutron/tests/unit/test_wsgi.py @@ -26,6 +26,7 @@ import webob import webob.exc from neutron.common import exceptions as n_exc +from neutron.common import ipv6_utils from neutron.tests import base from neutron.tests.common import helpers from neutron import wsgi @@ -108,6 +109,9 @@ class TestWSGIServer(base.BaseTestCase): server.wait() launcher.wait.assert_called_once_with() + @testtools.skipIf( + not ipv6_utils.is_enabled_and_bind_by_default(), + 'IPv6 support disabled on host') def test_start_random_port_with_ipv6(self): server = wsgi.Server("test_random_port") server.start(None, 0, host="::1")