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.

Conflicts:
	neutron/tests/tools.py

Related-Bug: #1484837
Change-Id: I89e1822bb92dfcf8772bba1a3edf908c89550119
This commit is contained in:
YAMAMOTO Takashi 2015-09-28 14:48:55 +09:00 committed by Ihar Hrachyshka
parent bcdaca33be
commit 445f5a4ad6
2 changed files with 15 additions and 0 deletions

View File

@ -13,6 +13,7 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
import platform
import warnings import warnings
import fixtures import fixtures
@ -121,3 +122,14 @@ class UnorderedList(list):
def __neq__(self, other): def __neq__(self, other):
return not self == other return not self == other
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

View File

@ -23,6 +23,7 @@ from oslo_config import cfg
from oslo_utils import importutils from oslo_utils import importutils
import six import six
from sqlalchemy import orm from sqlalchemy import orm
import testtools
from testtools import matchers from testtools import matchers
import webob.exc import webob.exc
@ -3414,6 +3415,7 @@ class TestSubnetsV2(NeutronDbPluginV2TestCase):
ipv6_ra_mode=constants.IPV6_SLAAC, ipv6_ra_mode=constants.IPV6_SLAAC,
ipv6_address_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): def test_create_subnet_ipv6_pd_gw_values(self):
cidr = constants.PROVISIONAL_IPV6_PD_PREFIX cidr = constants.PROVISIONAL_IPV6_PD_PREFIX
# Gateway is last IP in IPv6 DHCPv6 Stateless subnet # Gateway is last IP in IPv6 DHCPv6 Stateless subnet
@ -3540,6 +3542,7 @@ class TestSubnetsV2(NeutronDbPluginV2TestCase):
cidr=cidr, ip_version=6, cidr=cidr, ip_version=6,
allocation_pools=allocation_pools) allocation_pools=allocation_pools)
@testtools.skipIf(tools.is_bsd(), 'bug/1484837')
def test_create_subnet_with_v6_pd_allocation_pool(self): def test_create_subnet_with_v6_pd_allocation_pool(self):
gateway_ip = '::1' gateway_ip = '::1'
cidr = constants.PROVISIONAL_IPV6_PD_PREFIX cidr = constants.PROVISIONAL_IPV6_PD_PREFIX