From 2f6279e3e9a8561e74026ab3f3e639903014081b Mon Sep 17 00:00:00 2001 From: YAMAMOTO Takashi Date: Mon, 28 Sep 2015 14:48:55 +0900 Subject: [PATCH] test_db_base_plugin_v2: Skip a few tests on some platforms netaddr (and its underlying libc inet_pton) produces different representations of IPv4-compat addresses for different platforms. Linux: >>> netaddr.IPAddress("::2") IPAddress('::2') >>> OSX: >>> netaddr.IPAddress("::2") IPAddress('::0.0.0.2') >>> As our API assumes Linux's way, skip affected test cases on the other platforms. Related-Bug: #1484837 Change-Id: I89e1822bb92dfcf8772bba1a3edf908c89550119 --- neutron/tests/tools.py | 12 ++++++++++++ neutron/tests/unit/db/test_db_base_plugin_v2.py | 3 +++ 2 files changed, 15 insertions(+) diff --git a/neutron/tests/tools.py b/neutron/tests/tools.py index c09408548..c469ab7da 100644 --- a/neutron/tests/tools.py +++ b/neutron/tests/tools.py @@ -14,6 +14,7 @@ # under the License. import mock +import platform import random import string import warnings @@ -176,3 +177,14 @@ def get_random_boolean(): def get_random_integer(range_begin=0, range_end=1000): return random.randint(range_begin, range_end) + + +def is_bsd(): + """Return True on BSD-based systems.""" + + system = platform.system() + if system == 'Darwin': + return True + if 'bsd' in system.lower(): + return True + return False diff --git a/neutron/tests/unit/db/test_db_base_plugin_v2.py b/neutron/tests/unit/db/test_db_base_plugin_v2.py index d5f755d3b..6d57248dc 100644 --- a/neutron/tests/unit/db/test_db_base_plugin_v2.py +++ b/neutron/tests/unit/db/test_db_base_plugin_v2.py @@ -23,6 +23,7 @@ from oslo_config import cfg from oslo_utils import importutils import six from sqlalchemy import orm +import testtools from testtools import matchers import webob.exc @@ -3414,6 +3415,7 @@ class TestSubnetsV2(NeutronDbPluginV2TestCase): ipv6_ra_mode=constants.IPV6_SLAAC, ipv6_address_mode=constants.IPV6_SLAAC) + @testtools.skipIf(tools.is_bsd(), 'bug/1484837') def test_create_subnet_ipv6_pd_gw_values(self): cidr = constants.PROVISIONAL_IPV6_PD_PREFIX # Gateway is last IP in IPv6 DHCPv6 Stateless subnet @@ -3540,6 +3542,7 @@ class TestSubnetsV2(NeutronDbPluginV2TestCase): cidr=cidr, ip_version=6, allocation_pools=allocation_pools) + @testtools.skipIf(tools.is_bsd(), 'bug/1484837') def test_create_subnet_with_v6_pd_allocation_pool(self): gateway_ip = '::1' cidr = constants.PROVISIONAL_IPV6_PD_PREFIX -- 2.45.2