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 2018/02/16 20:13:25 UTC
[2/3] qpid-dispatch git commit: DISPATCH-920: self test to detect
interrouter links being blocked
DISPATCH-920: self test to detect interrouter links being blocked
(cherry picked from commit 1f2e3d929af763300af9d901bbe14336ee72bcd5)
Project: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/commit/4126e19b
Tree: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/tree/4126e19b
Diff: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/diff/4126e19b
Branch: refs/heads/1.0.x
Commit: 4126e19b0489f15ea76854b180a0475e9035b861
Parents: 6ba4d09
Author: Chuck Rolke <cr...@redhat.com>
Authored: Mon Jan 29 15:48:49 2018 -0500
Committer: Ganesh Murthy <gm...@redhat.com>
Committed: Fri Feb 16 15:07:57 2018 -0500
----------------------------------------------------------------------
tests/policy-5/permissive-default.json | 15 +++++++++
tests/system_tests_policy.py | 52 +++++++++++++++++++++++++++++
2 files changed, 67 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/4126e19b/tests/policy-5/permissive-default.json
----------------------------------------------------------------------
diff --git a/tests/policy-5/permissive-default.json b/tests/policy-5/permissive-default.json
new file mode 100644
index 0000000..23f29e9
--- /dev/null
+++ b/tests/policy-5/permissive-default.json
@@ -0,0 +1,15 @@
+[
+ ["vhost", {
+ "id": "$default",
+ "allowUnknownUser": true,
+ "groups" : {
+ "$default": {
+ "remoteHosts": "*",
+ "allowDynamicSource": true,
+ "allowAnonymousSender": true,
+ "sources": "*",
+ "targets": "*"
+ }
+ }
+ }]
+]
http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/4126e19b/tests/system_tests_policy.py
----------------------------------------------------------------------
diff --git a/tests/system_tests_policy.py b/tests/system_tests_policy.py
index 120137d..64475e0 100644
--- a/tests/system_tests_policy.py
+++ b/tests/system_tests_policy.py
@@ -301,5 +301,57 @@ class SenderReceiverLimits(TestCase):
bs1.close()
+
+class InterrouterLinksAllowed(TestCase):
+
+ inter_router_port = None
+
+ @classmethod
+ def setUpClass(cls):
+ """Start a router"""
+ super(InterrouterLinksAllowed, cls).setUpClass()
+
+ policy_config_path = os.path.join(DIR, 'policy-5')
+
+ def router(name, connection):
+
+ config = [
+ ('router', {'mode': 'interior', 'id': name}),
+ ('listener', {'port': cls.tester.get_port()}),
+ ('log', {'module': 'DEFAULT', 'enable': 'trace+'}),
+ ('policy', {'enableVhostPolicy': 'yes', 'policyDir': policy_config_path}),
+ connection
+ ]
+
+ config = Qdrouterd.Config(config)
+
+ cls.routers.append(cls.tester.qdrouterd(name, config, wait=True))
+
+ cls.routers = []
+
+ inter_router_port = cls.tester.get_port()
+
+ router('A', ('listener', {'role': 'inter-router', 'port': inter_router_port}))
+ router('B', ('connector', {'name': 'connectorToA', 'role': 'inter-router', 'port': inter_router_port, 'verifyHostName': 'no'}))
+
+ # With these configs before DISPATCH-920 the routers never connect
+ # because the links are disallowed by policy. Before the wait_ready
+ # functions complete the routers should have tried the interrouter
+ # link.
+
+ cls.routers[0].wait_ready()
+ cls.routers[1].wait_ready()
+
+ cls.routers[0].teardown()
+ cls.routers[1].teardown()
+
+ def test_01_dispatch_920(self):
+
+ with open('../setUpClass/A-2.out', 'r') as router_log:
+ log_lines = router_log.read().split("\n")
+ disallow_lines = [s for s in log_lines if "link disallowed" in s]
+ self.assertTrue(len(disallow_lines) == 0, msg='All links should be allowed but some were blocked by policy.')
+
+
if __name__ == '__main__':
unittest.main(main_module())
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org