kgiusti commented on a change in pull request #697: DISPATCH-1582 - Ignore router control message with version greater th… URL: https://github.com/apache/qpid-dispatch/pull/697#discussion_r389050032
########## File path: tests/system_tests_routing_protocol.py ########## @@ -0,0 +1,252 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# + +from __future__ import unicode_literals +from __future__ import division +from __future__ import absolute_import +from __future__ import print_function + +from proton import Message, Timeout, symbol, int32 +from system_test import TestCase, Qdrouterd, main_module, TIMEOUT +from system_test import unittest +from proton.handlers import MessagingHandler +from proton.reactor import Container, DynamicNodeProperties +from qpid_dispatch_internal.compat import UNICODE +from qpid_dispatch.management.client import Node + + +class RouterTest(TestCase): + + inter_router_port = None + + @classmethod + def setUpClass(cls): + """Start a router""" + super(RouterTest, cls).setUpClass() + + def router(name, connection): + + config = [ + ('router', {'mode': 'interior', 'id': name}), + ('listener', {'port': cls.tester.get_port(), 'stripAnnotations': 'no'}), + ('listener', {'port': cls.tester.get_port(), 'stripAnnotations': 'no', 'multiTenant': 'yes'}), + ('listener', {'port': cls.tester.get_port(), 'stripAnnotations': 'no', 'role': 'route-container'}), + 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'})) + + cls.routers[0].wait_router_connected('B') + cls.routers[1].wait_router_connected('A') + + + def test_01_reject_higher_version_hello(self): + test = RejectHigherVersionHelloTest(self.routers[0].addresses[3]) + test.run() + self.assertEqual(None, test.error) + + def test_02_reject_higher_version_mar(self): + test = RejectHigherVersionMARTest(self.routers[0].addresses[3], self.routers[0].addresses[0]) + test.run() + self.assertEqual(None, test.error) + + +class Entity(object): + def __init__(self, status_code, status_description, attrs): + self.status_code = status_code + self.status_description = status_description + self.attrs = attrs + + def __getattr__(self, key): + return self.attrs[key] + + +class RouterProxy(object): + def __init__(self, reply_addr): + self.reply_addr = reply_addr + + def response(self, msg): + ap = msg.properties + return Entity(ap['statusCode'], ap['statusDescription'], msg.body) + + def read_address(self, name): + ap = {'operation': 'READ', 'type': 'org.apache.qpid.dispatch.router.address', 'name': name} + return Message(properties=ap, reply_to=self.reply_addr) + + def query_addresses(self): + ap = {'operation': 'QUERY', 'type': 'org.apache.qpid.dispatch.router.address'} + return Message(properties=ap, reply_to=self.reply_addr) + + +class Timeout(object): Review comment: import this from system_test rather than define a new one ---------------------------------------------------------------- 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]
