ganeshmurthy commented on a change in pull request #602: DISPATCH-1453 - Fix
the code so the correct error message shows up wh…
URL: https://github.com/apache/qpid-dispatch/pull/602#discussion_r340069963
##########
File path: tests/system_tests_one_router.py
##########
@@ -3160,6 +3159,86 @@ def on_message(self, event):
self.receiver.close()
self.recv_conn.close()
+class OneRouterUnavailableCoordinatorTest(TestCase):
+ @classmethod
+ def setUpClass(cls):
+ super(OneRouterUnavailableCoordinatorTest, cls).setUpClass()
+ name = "test-router"
+ OneRouterTest.listen_port = cls.tester.get_port()
+ config = Qdrouterd.Config([
+ ('router', {'mode': 'standalone', 'id': 'QDR',
'defaultDistribution': 'unavailable'}),
+ ('listener', {'port': cls.tester.get_port() }),
+ ('address', {'prefix': 'closest', 'distribution': 'closest'}),
+ ('address', {'prefix': 'balanced', 'distribution': 'balanced'}),
+ ('address', {'prefix': 'multicast', 'distribution': 'multicast'}),
+ ])
+ cls.router = cls.tester.qdrouterd(name, config)
+ cls.router.wait_ready()
+ cls.address = cls.router.addresses[0]
+
+ def test_46_coordinator_linkroute_unavailable_DISPATCH_1453(self):
+ # The defaultDistribution on the router is unavailable. We try to
connect a tx sender
+ # to make sure a good detailed message saying "the link route to a
coordinator must be
+ # configured" is sent back.
+ test = RejectCoordinatorGoodMessageTest(self.address)
+ test.run()
+ self.assertTrue(test.passed)
+
+ def test_47_coordinator_linkroute_available_DISPATCH_1453(self):
+ # The defaultDistribution on the router is unavailable. We create a
link route with $coordinator address
+ # The link route is not attached to any broker. When the attach comes
in, the reject message must be
+ # condition=:"qd:no-route-to-dest", description="No route to the
destination node"
+ COORDINATOR = "$coordinator"
+ long_type = 'org.apache.qpid.dispatch.router.config.linkRoute'
+ qd_manager = QdManager(self, address=self.address)
+ args = {"prefix": COORDINATOR, "connection": "broker", "dir": "in"}
+ qd_manager.create(long_type, args)
+ link_route_created = False
+
+ # Verify that the link route was created by querying for it.
+ outs = qd_manager.query(long_type)[0]
+ if outs:
+ try:
+ if outs['prefix'] == COORDINATOR:
+ link_route_created = True
+ except:
+ pass
+
+ self.assertTrue(link_route_created)
+
+ # We have verified that the link route has been created but there is
no broker connections.
+ # Now let's try to open a transaction. We should get a no route to
destination error
+ test = RejectCoordinatorGoodMessageTest(self.address,
link_route_present=True)
+ test.run()
+ self.assertTrue(test.passed)
+
+
+class RejectCoordinatorGoodMessageTest(RejectCoordinatorTest):
+ def __init__(self, url, link_route_present=False):
+ super(RejectCoordinatorGoodMessageTest, self).__init__(url)
+ self.link_route_present = link_route_present
+ self.error_with_link_route = "No route to the destination node"
+
+ def on_link_error(self, event):
Review comment:
Removed duplicate on_link_error. thanks
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]