[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
This commit is contained in:
Slawek Kaplonski 2018-06-28 12:22:28 +02:00
parent 885c1213f9
commit 6906c4017f
1 changed files with 4 additions and 0 deletions

View File

@ -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")