]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
Check for configured IPV6 before running tests
authorJohn Griffith <john.griffith@solidfire.com>
Thu, 17 Jan 2013 23:30:32 +0000 (16:30 -0700)
committerJohn Griffith <john.griffith@solidfire.com>
Thu, 17 Jan 2013 23:32:14 +0000 (16:32 -0700)
Some folks don't/can't have IPV6 configured on their systems,
the new IPV6 tests in test_wsgi require that you do, so
let's add a check and skip if there are no IPV6 configured interfaces.

Change-Id: I7cbdcbc3ad4cc4690634f6464d6e28d9f4dfd791

cinder/tests/test_wsgi.py

index 288f60d57039bfd743f94d0815dff8dfb3012af5..f69c7e0a4143ec597181af964e901736a14c4478 100644 (file)
@@ -30,6 +30,7 @@ from cinder.api.middleware import fault
 from cinder import exception
 from cinder.openstack.common import cfg
 from cinder import test
+from cinder import utils
 import cinder.wsgi
 
 CONF = cfg.CONF
@@ -102,6 +103,11 @@ class TestWSGIServer(unittest.TestCase):
         server.wait()
 
     def test_start_random_port_with_ipv6(self):
+        #check to see if we have IPV6 configured on this system
+        out, err = utils.execute('cat', '/proc/net/if_inet6')
+        if not out:
+            self.skipTest("No IPV6 interface configured")
+
         server = cinder.wsgi.Server("test_random_port",
                                     None,
                                     host="::1")
@@ -151,6 +157,11 @@ class TestWSGIServer(unittest.TestCase):
         server.stop()
 
     def test_app_using_ipv6_and_ssl(self):
+        #check to see if we have IPV6 configured on this system
+        out, err = utils.execute('cat', '/proc/net/if_inet6')
+        if not out:
+            self.skipTest("No IPV6 interface configured")
+
         CONF.set_default("ssl_cert_file",
                          os.path.join(TEST_VAR_DIR, 'certificate.crt'))
         CONF.set_default("ssl_key_file",