]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
test_db_base_plugin_v2: Skip a few tests on some platforms
authorYAMAMOTO Takashi <yamamoto@midokura.com>
Mon, 28 Sep 2015 05:48:55 +0000 (14:48 +0900)
committerYAMAMOTO Takashi <yamamoto@midokura.com>
Tue, 13 Oct 2015 00:32:01 +0000 (09:32 +0900)
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
neutron/tests/unit/db/test_db_base_plugin_v2.py

index c09408548b2a11be79db71b81dda580bdbfebc65..c469ab7da788bfef73fbab490239d23ca04d33f1 100644 (file)
@@ -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
index d5f755d3bc9a5972429bdede8625a818a0e15af2..6d57248dc44a4fe8c958dcfca388013a340ea24b 100644 (file)
@@ -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