Skip IPv6 tests if IPv6 is not supported.
Change-Id: I8aac6b0bc675a223213348324ac8305907eb0028
This commit is contained in:
parent
8748cfa3a6
commit
64ef907e79
@ -16,12 +16,14 @@
|
||||
|
||||
import datetime
|
||||
import os
|
||||
import socket
|
||||
import subprocess
|
||||
import sys
|
||||
import time
|
||||
|
||||
import eventlet
|
||||
import mox
|
||||
import nose.exc
|
||||
from paste import deploy
|
||||
import stubout
|
||||
import unittest2 as unittest
|
||||
@ -302,3 +304,15 @@ class TestCase(NoModule, unittest.TestCase):
|
||||
:param delta: Maximum allowable time delta, defined in seconds.
|
||||
"""
|
||||
self.assertAlmostEqual(a, b, delta=datetime.timedelta(seconds=delta))
|
||||
|
||||
@staticmethod
|
||||
def skip_if_no_ipv6():
|
||||
try:
|
||||
s = socket.socket(socket.AF_INET6)
|
||||
except socket.error as e:
|
||||
if e.errno == errno.EAFNOSUPPORT:
|
||||
raise nose.exc.SkipTest("IPv6 is not enabled in the system")
|
||||
else:
|
||||
raise
|
||||
else:
|
||||
s.close()
|
||||
|
@ -27,6 +27,10 @@ CONF = config.CONF
|
||||
|
||||
|
||||
class IPv6TestCase(test.TestCase):
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
cls.skip_if_no_ipv6()
|
||||
|
||||
def setUp(self):
|
||||
super(IPv6TestCase, self).setUp()
|
||||
self.load_backends()
|
||||
|
@ -85,6 +85,7 @@ class SSLTestCase(test.TestCase):
|
||||
"""
|
||||
Make sure both public and admin API work with 1-way ipv6 & SSL.
|
||||
"""
|
||||
self.skip_if_no_ipv6()
|
||||
self.public_server = self.serveapp('keystone', name='main',
|
||||
cert=CERT, key=KEY, ca=CA,
|
||||
host="::1", port=0)
|
||||
@ -107,6 +108,7 @@ class SSLTestCase(test.TestCase):
|
||||
Make sure both public and admin API work with 2-way ipv6 & SSL.
|
||||
Requires client certificate.
|
||||
"""
|
||||
self.skip_if_no_ipv6()
|
||||
self.public_server = self.serveapp(
|
||||
'keystone', name='main', cert=CERT,
|
||||
key=KEY, ca=CA, cert_required=True,
|
||||
|
Loading…
Reference in New Issue
Block a user