You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by gm...@apache.org on 2017/02/01 15:44:17 UTC
qpid-dispatch git commit: DISPATCH-216 - Added code to skip
system_tests_protocol_family.py if IPv6 is turned off
Repository: qpid-dispatch
Updated Branches:
refs/heads/master 610739ff5 -> 0a60abbf6
DISPATCH-216 - Added code to skip system_tests_protocol_family.py if IPv6 is turned off
(cherry picked from commit 70fa43c5fea58ccbc0cec590b43d08f173d7600a)
Project: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/commit/0a60abbf
Tree: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/tree/0a60abbf
Diff: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/diff/0a60abbf
Branch: refs/heads/master
Commit: 0a60abbf6b06048e1ac7a71a48da82145fa77036
Parents: 610739f
Author: Ganesh Murthy <gm...@redhat.com>
Authored: Tue Jan 31 14:18:10 2017 -0500
Committer: Ganesh Murthy <gm...@redhat.com>
Committed: Wed Feb 1 10:43:30 2017 -0500
----------------------------------------------------------------------
tests/router_policy_test.py | 8 ++++----
tests/system_test.py | 14 ++++++++++++++
tests/system_tests_protocol_family.py | 10 +++++++++-
3 files changed, 27 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/0a60abbf/tests/router_policy_test.py
----------------------------------------------------------------------
diff --git a/tests/router_policy_test.py b/tests/router_policy_test.py
index af19277..5b787a7 100644
--- a/tests/router_policy_test.py
+++ b/tests/router_policy_test.py
@@ -24,7 +24,7 @@ from qpid_dispatch_internal.policy.policy_util import HostStruct
from qpid_dispatch_internal.policy.policy_util import PolicyError
from qpid_dispatch_internal.policy.policy_util import PolicyAppConnectionMgr
from qpid_dispatch_internal.policy.policy_local import PolicyLocal
-from system_test import TestCase, main_module
+from system_test import TestCase, main_module, is_ipv6_enabled
class PolicyHostAddrTest(TestCase):
@@ -61,7 +61,7 @@ class PolicyHostAddrTest(TestCase):
self.check_hostaddr_match(bbb, "1.1.2.0", False)
def test_policy_hostaddr_ipv6(self):
- if not HostAddr.has_ipv6:
+ if not is_ipv6_enabled():
self.skipTest("System IPv6 support is not available")
# Create simple host and range
aaa = HostAddr("::1")
@@ -88,7 +88,7 @@ class PolicyHostAddrTest(TestCase):
def test_policy_hostaddr_ipv6_wildcard(self):
- if not HostAddr.has_ipv6:
+ if not is_ipv6_enabled():
self.skipTest("System IPv6 support is not available")
aaa = HostAddr("*")
self.check_hostaddr_match(aaa,"::0")
@@ -101,7 +101,7 @@ class PolicyHostAddrTest(TestCase):
self.expect_deny( "9.9.9.9,8.8.8.8", "a > b")
def test_policy_malformed_hostaddr_ipv6(self):
- if not HostAddr.has_ipv6:
+ if not is_ipv6_enabled():
self.skipTest("System IPv6 support is not available")
self.expect_deny( "1::2::3", "Name or service not known")
self.expect_deny( "::1,::2,::3", "arg count")
http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/0a60abbf/tests/system_test.py
----------------------------------------------------------------------
diff --git a/tests/system_test.py b/tests/system_test.py
index 0c67a6e..1e7cd2e 100755
--- a/tests/system_test.py
+++ b/tests/system_test.py
@@ -143,6 +143,20 @@ def get_local_host_socket(protocol_family='IPv4'):
return s, host
+def is_ipv6_enabled():
+ """
+ Returns true if IPV6 is enabled, false otherwise
+ """
+ sock = socket.socket(socket.AF_INET6, socket.SOCK_STREAM)
+ ipv6_enabled = True
+ try:
+ sock.bind(('::1', 0))
+ except Exception as e:
+ if "socket.error" in str(type(e)):
+ ipv6_enabled = False
+
+ return ipv6_enabled
+
def port_available(port, protocol_family='IPv4'):
"""Return true if connecting to host:port gives 'connection refused'."""
s, host = get_local_host_socket(protocol_family)
http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/0a60abbf/tests/system_tests_protocol_family.py
----------------------------------------------------------------------
diff --git a/tests/system_tests_protocol_family.py b/tests/system_tests_protocol_family.py
index 20822c1..9c0e9fe 100644
--- a/tests/system_tests_protocol_family.py
+++ b/tests/system_tests_protocol_family.py
@@ -20,7 +20,7 @@
import unittest
from time import sleep
from proton import Message
-from system_test import TestCase, Qdrouterd, main_module
+from system_test import TestCase, Qdrouterd, main_module, is_ipv6_enabled
try:
from proton import MODIFIED
@@ -31,6 +31,7 @@ except ImportError:
class ProtocolFamilyTest(TestCase):
@classmethod
def setUpClass(cls):
+
"""
Starts three routers with various listeners and connectors.
There is a call to wait_router_connected to make sure that the routers are able to communicate with each
@@ -71,6 +72,9 @@ class ProtocolFamilyTest(TestCase):
# and tests each connector
cls.routers.append(cls.tester.qdrouterd(name, config, wait=True))
+ if not is_ipv6_enabled():
+ return
+
cls.routers = []
inter_router_port = cls.tester.get_port(protocol_family='IPv6')
@@ -105,6 +109,10 @@ class ProtocolFamilyTest(TestCase):
# If this test has started executing, it means that the setUpClass() has successfully executed which means that
# the routers were able to communicate with each other successfully using the specified protocol family.
def test_simple_pre_settled(self):
+
+ if not is_ipv6_enabled():
+ return self.skipTest("Skipping test..IPV6 not enabled")
+
addr = self.routers[0].addresses[4]+"/test/1"
M1 = self.messenger()
M2 = self.messenger()
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org