Repository: qpid-interop-test Updated Branches: refs/heads/master 2ce7f6970 -> 73a2aa661
QPIDIT-2: Added --include-type and --exclude-type parameters, as well as --no-skip flag to control tests Project: http://git-wip-us.apache.org/repos/asf/qpid-interop-test/repo Commit: http://git-wip-us.apache.org/repos/asf/qpid-interop-test/commit/e622fa57 Tree: http://git-wip-us.apache.org/repos/asf/qpid-interop-test/tree/e622fa57 Diff: http://git-wip-us.apache.org/repos/asf/qpid-interop-test/diff/e622fa57 Branch: refs/heads/master Commit: e622fa5798a4211ec5e74d456d945b3fe5a146e4 Parents: 2ce7f69 Author: Kim van der Riet <[email protected]> Authored: Mon Dec 12 13:31:35 2016 -0500 Committer: Kim van der Riet <[email protected]> Committed: Mon Dec 12 13:31:35 2016 -0500 ---------------------------------------------------------------------- .../amqp_large_content_test.py | 78 ++++++--- src/python/qpid_interop_test/amqp_types_test.py | 167 +++++++++---------- .../qpid_interop_test/jms_hdrs_props_test.py | 133 ++++++++------- .../qpid_interop_test/jms_messages_test.py | 126 +++++++------- src/python/qpid_interop_test/test_type_map.py | 21 +++ 5 files changed, 285 insertions(+), 240 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/qpid-interop-test/blob/e622fa57/src/python/qpid_interop_test/amqp_large_content_test.py ---------------------------------------------------------------------- diff --git a/src/python/qpid_interop_test/amqp_large_content_test.py b/src/python/qpid_interop_test/amqp_large_content_test.py index 2be6eb3..602bd0c 100755 --- a/src/python/qpid_interop_test/amqp_large_content_test.py +++ b/src/python/qpid_interop_test/amqp_large_content_test.py @@ -197,18 +197,26 @@ class TestOptions(object): """ Class controlling command-line arguments used to control the test. """ - def __init__(self): + def __init__(self, shim_map): parser = argparse.ArgumentParser(description='Qpid-interop AMQP client interoparability test suite ' 'for AMQP messages with large content') parser.add_argument('--sender', action='store', default='localhost:5672', metavar='IP-ADDR:PORT', help='Node to which test suite will send messages.') parser.add_argument('--receiver', action='store', default='localhost:5672', metavar='IP-ADDR:PORT', help='Node from which test suite will receive messages.') + parser.add_argument('--no-skip', action='store_true', + help='Do not skip tests that are excluded by default for reasons of a known bug') + type_group = parser.add_mutually_exclusive_group() + type_group.add_argument('--include-type', action='append', metavar='AMQP-TYPE', + help='Name of AMQP type to include. Supported types:\n%s' % + sorted(AmqpVariableSizeTypes.TYPE_MAP.keys())) + type_group.add_argument('--exclude-type', action='append', metavar='AMQP-TYPE', + help='Name of AMQP type to exclude. Supported types: see "include-type" above') shim_group = parser.add_mutually_exclusive_group() shim_group.add_argument('--include-shim', action='append', metavar='SHIM-NAME', - help='Name of shim to include. Supported shims:\n%s' % sorted(SHIM_MAP.keys())) + help='Name of shim to include. Supported shims:\n%s' % sorted(shim_map.keys())) shim_group.add_argument('--exclude-shim', action='append', metavar='SHIM-NAME', - help='Name of shim to exclude. Supported shims:\n%s' % sorted(SHIM_MAP.keys())) + help='Name of shim to exclude. Supported shims: see "include-shim" above') self.args = parser.parse_args() @@ -216,9 +224,48 @@ class TestOptions(object): if __name__ == '__main__': - ARGS = TestOptions().args + # SHIM_MAP contains an instance of each client language shim that is to be tested as a part of this test. For + # every shim in this list, a test is dynamically constructed which tests it against itself as well as every + # other shim in the list. + # + # As new shims are added, add them into this map to have them included in the test cases. + PROTON_CPP_RECEIVER_SHIM = path.join(QPID_INTEROP_TEST_HOME, 'shims', 'qpid-proton-cpp', 'amqp_large_content_test', + 'Receiver') + PROTON_CPP_SENDER_SHIM = path.join(QPID_INTEROP_TEST_HOME, 'shims', 'qpid-proton-cpp', 'amqp_large_content_test', + 'Sender') + PROTON_PYTHON_RECEIVER_SHIM = path.join(QPID_INTEROP_TEST_HOME, 'shims', 'qpid-proton-python', + 'amqp_large_content_test', 'Receiver.py') + PROTON_PYTHON_SENDER_SHIM = path.join(QPID_INTEROP_TEST_HOME, 'shims', 'qpid-proton-python', 'amqp_large_content_test', + 'Sender.py') + + SHIM_MAP = {qpid_interop_test.shims.ProtonCppShim.NAME: \ + qpid_interop_test.shims.ProtonCppShim(PROTON_CPP_SENDER_SHIM, PROTON_CPP_RECEIVER_SHIM), + qpid_interop_test.shims.ProtonPythonShim.NAME: \ + qpid_interop_test.shims.ProtonPythonShim(PROTON_PYTHON_SENDER_SHIM, PROTON_PYTHON_RECEIVER_SHIM), + } + + ARGS = TestOptions(SHIM_MAP).args #print 'ARGS:', ARGS # debug + # Add shims included from the command-line + if ARGS.include_shim is not None: + new_shim_map = {} + for shim in ARGS.include_shim: + try: + new_shim_map[shim] = SHIM_MAP[shim] + except KeyError: + print 'No such shim: "%s". Use --help for valid shims' % shim + sys.exit(1) # Errors or failures present + SHIM_MAP = new_shim_map + # Remove shims excluded from the command-line + elif ARGS.exclude_shim is not None: + for shim in ARGS.exclude_shim: + try: + SHIM_MAP.pop(shim) + except KeyError: + print 'No such shim: "%s". Use --help for valid shims' % shim + sys.exit(1) # Errors or failures present + # Connect to broker to find broker type CONNECTION_PROPS = qpid_interop_test.broker_properties.get_broker_properties(ARGS.sender) if CONNECTION_PROPS is None: @@ -234,32 +281,15 @@ if __name__ == '__main__': print 'Test Broker: %s v.%s on %s' % (BROKER, BROKER_VERSION, BROKER_PLATFORM) print sys.stdout.flush() + if ARGS.no_skip: + BROKER = None # Will cause all tests to run - TYPES = AmqpVariableSizeTypes() + TYPES = AmqpVariableSizeTypes().get_types(ARGS) # TEST_SUITE is the final suite of tests that will be run and which contains all the dynamically created # type classes, each of which contains a test for the combinations of client shims TEST_SUITE = unittest.TestSuite() - # Add shims included from the command-line - if ARGS.include_shim is not None: - new_shim_map = {} - for shim in ARGS.include_shim: - try: - new_shim_map[shim] = SHIM_MAP[shim] - except KeyError: - print 'No such shim: "%s". Use --help for valid shims' % shim - sys.exit(1) # Errors or failures present - SHIM_MAP = new_shim_map - # Remove shims excluded from the command-line - elif ARGS.exclude_shim is not None: - for shim in ARGS.exclude_shim: - try: - SHIM_MAP.pop(shim) - except KeyError: - print 'No such shim: "%s". Use --help for valid shims' % shim - sys.exit(1) # Errors or failures present - # Create test classes dynamically for at in sorted(TYPES.get_type_list()): test_case_class = create_testcase_class(at, product(SHIM_MAP.values(), repeat=2)) http://git-wip-us.apache.org/repos/asf/qpid-interop-test/blob/e622fa57/src/python/qpid_interop_test/amqp_types_test.py ---------------------------------------------------------------------- diff --git a/src/python/qpid_interop_test/amqp_types_test.py b/src/python/qpid_interop_test/amqp_types_test.py index d53dd38..bcf59f3 100755 --- a/src/python/qpid_interop_test/amqp_types_test.py +++ b/src/python/qpid_interop_test/amqp_types_test.py @@ -257,25 +257,29 @@ class AmqpPrimitiveTypes(TestTypeMap): # This section contains tests that should be skipped because of know issues that would cause the test to fail. # As the issues are resolved, these should be removed. - BROKER_SKIP = {'null': {'ActiveMQ': 'Null type not sent in Proton Python binding: PROTON-1091', - 'qpid-cpp': 'Null type not sent in Proton Python binding: PROTON-1091', - 'qpid-dispatch-router': 'router with qpid or activemq broker',}, - 'decimal32': {'ActiveMQ': 'decimal32 and decimal64 sent byte reversed: PROTON-1160', - 'qpid-cpp': 'decimal32 not supported on qpid-cpp broker: QPIDIT-5, QPID-6328', - 'apache-activemq-artemis': 'decimal32 and decimal64 sent byte reversed: PROTON-1160', - 'qpid-dispatch-router': 'decimal32 and decimal64 sent byte reversed: PROTON-1160',}, - 'decimal64': {'ActiveMQ': 'decimal32 and decimal64 sent byte reversed: PROTON-1160', - 'qpid-cpp': 'decimal64 not supported on qpid-cpp broker: QPIDIT-6, QPID-6328', - 'apache-activemq-artemis': 'decimal32 and decimal64 sent byte reversed: PROTON-1160', - 'qpid-dispatch-router': 'decimal32 and decimal64 sent byte reversed: PROTON-1160',}, - 'decimal128': {'qpid-cpp': 'decimal128 not supported on qpid-cpp broker: QPIDIT-3, QPID-6328', - 'qpid-dispatch-router': 'router with qpid or activemq broker',}, - 'char': {'qpid-cpp': 'char not supported on qpid-cpp broker: QPIDIT-4, QPID-6328', - 'apache-activemq-artemis': 'char types > 16 bits truncated on Artemis: ENTMQ-1685', - 'qpid-dispatch-router': 'router with qpid or artemis broker',}, - 'float': {'apache-activemq-artemis': '-NaN is stripped of its sign: ENTMQ-1686',}, - 'double': {'apache-activemq-artemis': '-NaN is stripped of its sign: ENTMQ-1686',}, - } + BROKER_SKIP = { + 'null': {'ActiveMQ': 'Null type not sent in Proton Python binding: PROTON-1091', + 'qpid-cpp': 'Null type not sent in Proton Python binding: PROTON-1091', + 'qpid-dispatch-router': 'router with qpid or activemq broker',}, + 'decimal32': {'ActiveMQ': 'decimal32 and decimal64 sent byte reversed: PROTON-1160', + 'qpid-cpp': 'decimal32 not supported on qpid-cpp broker: QPIDIT-5, QPID-6328', + 'apache-activemq-artemis': 'decimal32 and decimal64 sent byte reversed: PROTON-1160', + 'qpid-dispatch-router': 'decimal32 and decimal64 sent byte reversed: PROTON-1160',}, + 'decimal64': {'ActiveMQ': 'decimal32 and decimal64 sent byte reversed: PROTON-1160', + 'qpid-cpp': 'decimal64 not supported on qpid-cpp broker: QPIDIT-6, QPID-6328', + 'apache-activemq-artemis': 'decimal32 and decimal64 sent byte reversed: PROTON-1160', + 'qpid-dispatch-router': 'decimal32 and decimal64 sent byte reversed: PROTON-1160',}, + 'decimal128': {'qpid-cpp': 'decimal128 not supported on qpid-cpp broker: QPIDIT-3, QPID-6328', + 'qpid-dispatch-router': 'router with qpid or activemq broker',}, + 'char': {'qpid-cpp': 'char not supported on qpid-cpp broker: QPIDIT-4, QPID-6328', + 'apache-activemq-artemis': 'char types > 16 bits truncated on Artemis: ENTMQ-1685', + 'qpid-dispatch-router': 'router with qpid or artemis broker',}, + 'float': {'apache-activemq-artemis': '-NaN is stripped of its sign: ENTMQ-1686',}, + 'double': {'apache-activemq-artemis': '-NaN is stripped of its sign: ENTMQ-1686',}, + } + + def __init__(self): + super(AmqpPrimitiveTypes, self).__init__() def create_array(self, amqp_type, repeat): """ @@ -398,73 +402,84 @@ def create_testcase_class(amqp_type, shim_product): return new_class -# SHIM_MAP contains an instance of each client language shim that is to be tested as a part of this test. For -# every shim in this list, a test is dynamically constructed which tests it against itself as well as every -# other shim in the list. -# -# As new shims are added, add them into this map to have them included in the test cases. -PROTON_CPP_RECEIVER_SHIM = path.join(QPID_INTEROP_TEST_HOME, 'shims', 'qpid-proton-cpp', 'amqp_types_test', - 'Receiver') -PROTON_CPP_SENDER_SHIM = path.join(QPID_INTEROP_TEST_HOME, 'shims', 'qpid-proton-cpp', 'amqp_types_test', - 'Sender') -PROTON_PYTHON_RECEIVER_SHIM = path.join(QPID_INTEROP_TEST_HOME, 'shims', 'qpid-proton-python', 'amqp_types_test', - 'Receiver.py') -PROTON_PYTHON_SENDER_SHIM = path.join(QPID_INTEROP_TEST_HOME, 'shims', 'qpid-proton-python', 'amqp_types_test', - 'Sender.py') -PROTON_RHEAJS_RECEIVER_SHIM = path.join(QPID_INTEROP_TEST_HOME, 'shims', 'rhea-js', 'amqp_types_test', - 'Receiver.js') -PROTON_RHEAJS_SENDER_SHIM = path.join(QPID_INTEROP_TEST_HOME, 'shims', 'rhea-js', 'amqp_types_test', - 'Sender.js') - -SHIM_MAP = {qpid_interop_test.shims.ProtonCppShim.NAME: \ - qpid_interop_test.shims.ProtonCppShim(PROTON_CPP_SENDER_SHIM, PROTON_CPP_RECEIVER_SHIM), - qpid_interop_test.shims.ProtonPythonShim.NAME: \ - qpid_interop_test.shims.ProtonPythonShim(PROTON_PYTHON_SENDER_SHIM, PROTON_PYTHON_RECEIVER_SHIM), - qpid_interop_test.shims.RheaJsShim.NAME: \ - qpid_interop_test.shims.RheaJsShim(PROTON_RHEAJS_SENDER_SHIM, PROTON_RHEAJS_RECEIVER_SHIM), - } - - class TestOptions(object): """ Class controlling command-line arguments used to control the test. """ - def __init__(self): + def __init__(self, shim_map): parser = argparse.ArgumentParser(description='Qpid-interop AMQP client interoparability test suite ' 'for AMQP simple types') parser.add_argument('--sender', action='store', default='localhost:5672', metavar='IP-ADDR:PORT', help='Node to which test suite will send messages.') parser.add_argument('--receiver', action='store', default='localhost:5672', metavar='IP-ADDR:PORT', help='Node from which test suite will receive messages.') -# test_group = parser.add_mutually_exclusive_group() -# test_group.add_argument('--include-test', action='append', metavar='TEST-NAME', -# help='Name of test to include') -# test_group.add_argument('--exclude-test', action='append', metavar='TEST-NAME', -# help='Name of test to exclude') -# type_group = test_group.add_mutually_exclusive_group() -# type_group.add_argument('--include-type', action='append', metavar='AMQP-TYPE', -# help='Name of AMQP type to include. Supported types:\n%s' % -# sorted(AmqpPrimitiveTypes.TYPE_MAP.keys())) - parser.add_argument('--exclude-type', action='append', metavar='AMQP-TYPE', - help='Name of AMQP type to exclude. Supported types:\n%s' % - sorted(AmqpPrimitiveTypes.TYPE_MAP.keys())) + parser.add_argument('--no-skip', action='store_true', + help='Do not skip tests that are excluded by default for reasons of a known bug') + type_group = parser.add_mutually_exclusive_group() + type_group.add_argument('--include-type', action='append', metavar='AMQP-TYPE', + help='Name of AMQP type to include. Supported types:\n%s' % + sorted(AmqpPrimitiveTypes.TYPE_MAP.keys())) + type_group.add_argument('--exclude-type', action='append', metavar='AMQP-TYPE', + help='Name of AMQP type to exclude. Supported types: see "include-type" above') shim_group = parser.add_mutually_exclusive_group() shim_group.add_argument('--include-shim', action='append', metavar='SHIM-NAME', - help='Name of shim to include. Supported shims:\n%s' % sorted(SHIM_MAP.keys())) + help='Name of shim to include. Supported shims:\n%s' % sorted(shim_map.keys())) shim_group.add_argument('--exclude-shim', action='append', metavar='SHIM-NAME', - help='Name of shim to exclude. Supported shims:\n%s' % sorted(SHIM_MAP.keys())) + help='Name of shim to exclude. Supported shims: see "include-shim" above') self.args = parser.parse_args() -# if self.args.include_shim is not None and self.args.exclude_shim is not None: -# raise RuntimeError('Connot use --include-shim and --exclude-shim together') #--- Main program start --- if __name__ == '__main__': - ARGS = TestOptions().args + # SHIM_MAP contains an instance of each client language shim that is to be tested as a part of this test. For + # every shim in this list, a test is dynamically constructed which tests it against itself as well as every + # other shim in the list. + # + # As new shims are added, add them into this map to have them included in the test cases. + PROTON_CPP_RECEIVER_SHIM = path.join(QPID_INTEROP_TEST_HOME, 'shims', 'qpid-proton-cpp', 'amqp_types_test', + 'Receiver') + PROTON_CPP_SENDER_SHIM = path.join(QPID_INTEROP_TEST_HOME, 'shims', 'qpid-proton-cpp', 'amqp_types_test', + 'Sender') + PROTON_PYTHON_RECEIVER_SHIM = path.join(QPID_INTEROP_TEST_HOME, 'shims', 'qpid-proton-python', 'amqp_types_test', + 'Receiver.py') + PROTON_PYTHON_SENDER_SHIM = path.join(QPID_INTEROP_TEST_HOME, 'shims', 'qpid-proton-python', 'amqp_types_test', + 'Sender.py') + PROTON_RHEAJS_RECEIVER_SHIM = path.join(QPID_INTEROP_TEST_HOME, 'shims', 'rhea-js', 'amqp_types_test', + 'Receiver.js') + PROTON_RHEAJS_SENDER_SHIM = path.join(QPID_INTEROP_TEST_HOME, 'shims', 'rhea-js', 'amqp_types_test', + 'Sender.js') + SHIM_MAP = {qpid_interop_test.shims.ProtonCppShim.NAME: \ + qpid_interop_test.shims.ProtonCppShim(PROTON_CPP_SENDER_SHIM, PROTON_CPP_RECEIVER_SHIM), + qpid_interop_test.shims.ProtonPythonShim.NAME: \ + qpid_interop_test.shims.ProtonPythonShim(PROTON_PYTHON_SENDER_SHIM, PROTON_PYTHON_RECEIVER_SHIM), + qpid_interop_test.shims.RheaJsShim.NAME: \ + qpid_interop_test.shims.RheaJsShim(PROTON_RHEAJS_SENDER_SHIM, PROTON_RHEAJS_RECEIVER_SHIM), + } + + ARGS = TestOptions(SHIM_MAP).args #print 'ARGS:', ARGS # debug + # Add shims included from the command-line + if ARGS.include_shim is not None: + new_shim_map = {} + for shim in ARGS.include_shim: + try: + new_shim_map[shim] = SHIM_MAP[shim] + except KeyError: + print 'No such shim: "%s". Use --help for valid shims' % shim + sys.exit(1) # Errors or failures present + SHIM_MAP = new_shim_map + # Remove shims excluded from the command-line + elif ARGS.exclude_shim is not None: + for shim in ARGS.exclude_shim: + try: + SHIM_MAP.pop(shim) + except KeyError: + print 'No such shim: "%s". Use --help for valid shims' % shim + sys.exit(1) # Errors or failures present + # Connect to broker to find broker type # TODO: Find out why this uses auth CONNECTION_PROPS = qpid_interop_test.broker_properties.get_broker_properties(ARGS.sender) @@ -481,33 +496,15 @@ if __name__ == '__main__': print 'Test Broker: %s v.%s on %s' % (BROKER, BROKER_VERSION, BROKER_PLATFORM) print sys.stdout.flush() + if ARGS.no_skip: + BROKER = None # Will cause all tests to run - TYPES = AmqpPrimitiveTypes() + TYPES = AmqpPrimitiveTypes().get_types(ARGS) # TEST_SUITE is the final suite of tests that will be run and which contains all the dynamically created # type classes, each of which contains a test for the combinations of client shims TEST_SUITE = unittest.TestSuite() - - # Add shims included from the command-line - if ARGS.include_shim is not None: - new_shim_map = {} - for shim in ARGS.include_shim: - try: - new_shim_map[shim] = SHIM_MAP[shim] - except KeyError: - print 'No such shim: "%s". Use --help for valid shims' % shim - sys.exit(1) # Errors or failures present - SHIM_MAP = new_shim_map - # Remove shims excluded from the command-line - elif ARGS.exclude_shim is not None: - for shim in ARGS.exclude_shim: - try: - SHIM_MAP.pop(shim) - except KeyError: - print 'No such shim: "%s". Use --help for valid shims' % shim - sys.exit(1) # Errors or failures present - # Create test classes dynamically for at in sorted(TYPES.get_type_list()): if ARGS.exclude_type is None or at not in ARGS.exclude_type: http://git-wip-us.apache.org/repos/asf/qpid-interop-test/blob/e622fa57/src/python/qpid_interop_test/jms_hdrs_props_test.py ---------------------------------------------------------------------- diff --git a/src/python/qpid_interop_test/jms_hdrs_props_test.py b/src/python/qpid_interop_test/jms_hdrs_props_test.py index 34765ac..0264ca5 100755 --- a/src/python/qpid_interop_test/jms_hdrs_props_test.py +++ b/src/python/qpid_interop_test/jms_hdrs_props_test.py @@ -364,7 +364,7 @@ def create_part_a_testcase_class(): send_shim.NAME, receive_shim.NAME) setattr(cls, inner_test_method.__name__, inner_test_method) - jms_message_type = TYPES.TYPE_MAP.keys()[0] + jms_message_type = 'JMS_MESSAGE_TYPE' class_name = 'PartA_SingleJmsHeader_TestCase' class_dict = {'__name__': class_name, '__repr__': __repr__, @@ -422,7 +422,7 @@ def create_part_b_testcase_class(): send_shim.NAME, receive_shim.NAME) setattr(cls, inner_test_method.__name__, inner_test_method) - jms_message_type = TYPES.TYPE_MAP.keys()[0] + jms_message_type = 'JMS_MESSAGE_TYPE' class_name = 'PartB_JmsHeaderCombination_TestCase' class_dict = {'__name__': class_name, '__repr__': __repr__, @@ -493,7 +493,7 @@ def create_part_c_testcase_class(): send_shim.NAME, receive_shim.NAME) setattr(cls, inner_test_method.__name__, inner_test_method) - jms_message_type = TYPES.TYPE_MAP.keys()[0] + jms_message_type = 'JMS_MESSAGE_TYPE' class_name = 'PartC_SingleJmsProperty_TestCase' class_dict = {'__name__': class_name, '__repr__': __repr__, @@ -550,6 +550,7 @@ def create_part_d_testcase_class(jms_message_type): send_shim.NAME, receive_shim.NAME) setattr(cls, inner_test_method.__name__, inner_test_method) + jms_message_type = 'JMS_MESSAGE_TYPE' class_name = 'PartD_AllJmsHeaders_AllJmsProperties_TestCase' class_dict = {'__name__': class_name, '__repr__': __repr__, @@ -585,71 +586,86 @@ def create_part_d_testcase_class(jms_message_type): return new_class -PROTON_CPP_RECEIVER_SHIM = path.join(QPID_INTEROP_TEST_HOME, 'shims', 'qpid-proton-cpp', 'jms_hdrs_props_test', - 'Receiver') -PROTON_CPP_SENDER_SHIM = path.join(QPID_INTEROP_TEST_HOME, 'shims', 'qpid-proton-cpp', 'jms_hdrs_props_test', - 'Sender') -PROTON_PYTHON_RECEIVER_SHIM = path.join(QPID_INTEROP_TEST_HOME, 'shims', 'qpid-proton-python', 'jms_hdrs_props_test', - 'Receiver.py') -PROTON_PYTHON_SENDER_SHIM = path.join(QPID_INTEROP_TEST_HOME, 'shims', 'qpid-proton-python', 'jms_hdrs_props_test', - 'Sender.py') -QIT_JMS_CLASSPATH_FILE = path.join(QPID_INTEROP_TEST_HOME, 'shims', 'qpid-jms', 'cp.txt') -with open(QIT_JMS_CLASSPATH_FILE, 'r') as classpath_file: - QIT_JMS_CLASSPATH = classpath_file.read() -QPID_JMS_RECEIVER_SHIM = 'org.apache.qpid.interop_test.jms_hdrs_props_test.Receiver' -QPID_JMS_SENDER_SHIM = 'org.apache.qpid.interop_test.jms_hdrs_props_test.Sender' - -# SHIM_MAP contains an instance of each client language shim that is to be tested as a part of this test. For -# every shim in this list, a test is dynamically constructed which tests it against itself as well as every -# other shim in the list. -# -# As new shims are added, add them into this map to have them included in the test cases. -SHIM_MAP = {qpid_interop_test.shims.ProtonCppShim.NAME: \ - qpid_interop_test.shims.ProtonCppShim(PROTON_CPP_SENDER_SHIM, PROTON_CPP_RECEIVER_SHIM), - qpid_interop_test.shims.ProtonPythonShim.NAME: \ - qpid_interop_test.shims.ProtonPythonShim(PROTON_PYTHON_SENDER_SHIM, PROTON_PYTHON_RECEIVER_SHIM), - qpid_interop_test.shims.QpidJmsShim.NAME: \ - qpid_interop_test.shims.QpidJmsShim(QIT_JMS_CLASSPATH, QPID_JMS_SENDER_SHIM, QPID_JMS_RECEIVER_SHIM), - } - -# TODO: Complete the test options to give fine control over running tests class TestOptions(object): """ Class controlling command-line arguments used to control the test. """ - def __init__(self,): + def __init__(self, shim_map): parser = argparse.ArgumentParser(description='Qpid-interop AMQP client interoparability test suite ' 'for JMS headers and properties') parser.add_argument('--sender', action='store', default='localhost:5672', metavar='IP-ADDR:PORT', help='Node to which test suite will send messages.') parser.add_argument('--receiver', action='store', default='localhost:5672', metavar='IP-ADDR:PORT', help='Node from which test suite will receive messages.') -# test_group = parser.add_mutually_exclusive_group() -# test_group.add_argument('--include-test', action='append', metavar='TEST-NAME', -# help='Name of test to include') -# test_group.add_argument('--exclude-test', action='append', metavar='TEST-NAME', -# help='Name of test to exclude') -# type_group = test_group.add_mutually_exclusive_group() -# type_group.add_argument('--include-type', action='append', metavar='AMQP-TYPE', -# help='Name of AMQP type to include. Supported types:\n%s' % -# sorted(JmsMessageTypes.TYPE_MAP.keys())) - parser.add_argument('--exclude-type', action='append', metavar='JMS-MESSAGE-TYPE', - help='Name of JMS message type to exclude. Supported types:\n%s' % - sorted(JmsMessageTypes.TYPE_MAP.keys())) + parser.add_argument('--no-skip', action='store_true', + help='Do not skip tests that are excluded by default for reasons of a known bug') + type_group = parser.add_mutually_exclusive_group() + type_group.add_argument('--include-type', action='append', metavar='JMS_MESSAGE-TYPE', + help='Name of AMQP type to include. Supported types:\n%s' % + sorted(JmsMessageTypes.TYPE_MAP.keys())) + type_group.add_argument('--exclude-type', action='append', metavar='JMS_MESSAGE-TYPE', + help='Name of AMQP type to exclude. Supported types: see "include-type" above') shim_group = parser.add_mutually_exclusive_group() shim_group.add_argument('--include-shim', action='append', metavar='SHIM-NAME', - help='Name of shim to include. Supported shims:\n%s' % sorted(SHIM_MAP.keys())) + help='Name of shim to include. Supported shims:\n%s' % sorted(shim_map.keys())) shim_group.add_argument('--exclude-shim', action='append', metavar='SHIM-NAME', - help='Name of shim to exclude. Supported shims:\n%s' % sorted(SHIM_MAP.keys())) + help='Name of shim to exclude. Supported shims: see "include-shim" above') self.args = parser.parse_args() #--- Main program start --- if __name__ == '__main__': - ARGS = TestOptions().args + + PROTON_CPP_RECEIVER_SHIM = path.join(QPID_INTEROP_TEST_HOME, 'shims', 'qpid-proton-cpp', 'jms_hdrs_props_test', + 'Receiver') + PROTON_CPP_SENDER_SHIM = path.join(QPID_INTEROP_TEST_HOME, 'shims', 'qpid-proton-cpp', 'jms_hdrs_props_test', + 'Sender') + PROTON_PYTHON_RECEIVER_SHIM = path.join(QPID_INTEROP_TEST_HOME, 'shims', 'qpid-proton-python', 'jms_hdrs_props_test', + 'Receiver.py') + PROTON_PYTHON_SENDER_SHIM = path.join(QPID_INTEROP_TEST_HOME, 'shims', 'qpid-proton-python', 'jms_hdrs_props_test', + 'Sender.py') + QIT_JMS_CLASSPATH_FILE = path.join(QPID_INTEROP_TEST_HOME, 'shims', 'qpid-jms', 'cp.txt') + with open(QIT_JMS_CLASSPATH_FILE, 'r') as classpath_file: + QIT_JMS_CLASSPATH = classpath_file.read() + QPID_JMS_RECEIVER_SHIM = 'org.apache.qpid.interop_test.jms_hdrs_props_test.Receiver' + QPID_JMS_SENDER_SHIM = 'org.apache.qpid.interop_test.jms_hdrs_props_test.Sender' + + # SHIM_MAP contains an instance of each client language shim that is to be tested as a part of this test. For + # every shim in this list, a test is dynamically constructed which tests it against itself as well as every + # other shim in the list. + # + # As new shims are added, add them into this map to have them included in the test cases. + SHIM_MAP = {qpid_interop_test.shims.ProtonCppShim.NAME: \ + qpid_interop_test.shims.ProtonCppShim(PROTON_CPP_SENDER_SHIM, PROTON_CPP_RECEIVER_SHIM), + qpid_interop_test.shims.ProtonPythonShim.NAME: \ + qpid_interop_test.shims.ProtonPythonShim(PROTON_PYTHON_SENDER_SHIM, PROTON_PYTHON_RECEIVER_SHIM), + qpid_interop_test.shims.QpidJmsShim.NAME: \ + qpid_interop_test.shims.QpidJmsShim(QIT_JMS_CLASSPATH, QPID_JMS_SENDER_SHIM, QPID_JMS_RECEIVER_SHIM), + } + + ARGS = TestOptions(SHIM_MAP).args #print 'ARGS:', ARGS # debug + # Add shims included from the command-line + if ARGS.include_shim is not None: + new_shim_map = {} + for shim in ARGS.include_shim: + try: + new_shim_map[shim] = SHIM_MAP[shim] + except KeyError: + print 'No such shim: "%s". Use --help for valid shims' % shim + sys.exit(1) # Errors or failures present + SHIM_MAP = new_shim_map + # Remove shims excluded from the command-line + elif ARGS.exclude_shim is not None: + for shim in ARGS.exclude_shim: + try: + SHIM_MAP.pop(shim) + except KeyError: + print 'No such shim: "%s". Use --help for valid shims' % shim + sys.exit(1) # Errors or failures present + # Connect to broker to find broker type CONNECTION_PROPS = qpid_interop_test.broker_properties.get_broker_properties(ARGS.sender) if CONNECTION_PROPS is None: @@ -665,32 +681,15 @@ if __name__ == '__main__': print 'Test Broker: %s v.%s on %s' % (BROKER, BROKER_VERSION, BROKER_PLATFORM) print sys.stdout.flush() + if ARGS.no_skip: + BROKER = None # Will cause all tests to run - TYPES = JmsMessageTypes() + TYPES = JmsMessageTypes().get_types(ARGS) # TEST_SUITE is the final suite of tests that will be run and which contains all the dynamically created # type classes, each of which contains a test for the combinations of client shims TEST_SUITE = unittest.TestSuite() - # Add shims included from the command-line - if ARGS.include_shim is not None: - new_shim_map = {} - for shim in ARGS.include_shim: - try: - new_shim_map[shim] = SHIM_MAP[shim] - except KeyError: - print 'No such shim: "%s". Use --help for valid shims' % shim - sys.exit(1) # Errors or failures present - SHIM_MAP = new_shim_map - # Remove shims excluded from the command-line - elif ARGS.exclude_shim is not None: - for shim in ARGS.exclude_shim: - try: - SHIM_MAP.pop(shim) - except KeyError: - print 'No such shim: "%s". Use --help for valid shims' % shim - sys.exit(1) # Errors or failures present - # Create test classes dynamically create_testcases() http://git-wip-us.apache.org/repos/asf/qpid-interop-test/blob/e622fa57/src/python/qpid_interop_test/jms_messages_test.py ---------------------------------------------------------------------- diff --git a/src/python/qpid_interop_test/jms_messages_test.py b/src/python/qpid_interop_test/jms_messages_test.py index 7ddd590..3d83190 100755 --- a/src/python/qpid_interop_test/jms_messages_test.py +++ b/src/python/qpid_interop_test/jms_messages_test.py @@ -297,71 +297,86 @@ def create_testcase_class(jms_message_type, shim_product): return new_class -PROTON_CPP_RECEIVER_SHIM = path.join(QPID_INTEROP_TEST_HOME, 'shims', 'qpid-proton-cpp', 'jms_messages_test', - 'Receiver') -PROTON_CPP_SENDER_SHIM = path.join(QPID_INTEROP_TEST_HOME, 'shims', 'qpid-proton-cpp', 'jms_messages_test', - 'Sender') -PROTON_PYTHON_RECEIVER_SHIM = path.join(QPID_INTEROP_TEST_HOME, 'shims', 'qpid-proton-python', 'jms_messages_test', - 'Receiver.py') -PROTON_PYTHON_SENDER_SHIM = path.join(QPID_INTEROP_TEST_HOME, 'shims', 'qpid-proton-python', 'jms_messages_test', - 'Sender.py') -QIT_JMS_CLASSPATH_FILE = path.join(QPID_INTEROP_TEST_HOME, 'shims', 'qpid-jms', 'cp.txt') -with open(QIT_JMS_CLASSPATH_FILE, 'r') as classpath_file: - QIT_JMS_CLASSPATH = classpath_file.read() -QPID_JMS_RECEIVER_SHIM = 'org.apache.qpid.interop_test.jms_messages_test.Receiver' -QPID_JMS_SENDER_SHIM = 'org.apache.qpid.interop_test.jms_messages_test.Sender' - -# SHIM_MAP contains an instance of each client language shim that is to be tested as a part of this test. For -# every shim in this list, a test is dynamically constructed which tests it against itself as well as every -# other shim in the list. -# -# As new shims are added, add them into this map to have them included in the test cases. -SHIM_MAP = {qpid_interop_test.shims.ProtonCppShim.NAME: \ - qpid_interop_test.shims.ProtonCppShim(PROTON_CPP_SENDER_SHIM, PROTON_CPP_RECEIVER_SHIM), - qpid_interop_test.shims.ProtonPythonShim.NAME: \ - qpid_interop_test.shims.ProtonPythonShim(PROTON_PYTHON_SENDER_SHIM, PROTON_PYTHON_RECEIVER_SHIM), - qpid_interop_test.shims.QpidJmsShim.NAME: \ - qpid_interop_test.shims.QpidJmsShim(QIT_JMS_CLASSPATH, QPID_JMS_SENDER_SHIM, QPID_JMS_RECEIVER_SHIM), - } - -# TODO: Complete the test options to give fine control over running tests class TestOptions(object): """ Class controlling command-line arguments used to control the test. """ - def __init__(self,): + def __init__(self, shim_map): parser = argparse.ArgumentParser(description='Qpid-interop AMQP client interoparability test suite ' 'for JMS message types') parser.add_argument('--sender', action='store', default='localhost:5672', metavar='IP-ADDR:PORT', help='Node to which test suite will send messages.') parser.add_argument('--receiver', action='store', default='localhost:5672', metavar='IP-ADDR:PORT', help='Node from which test suite will receive messages.') -# test_group = parser.add_mutually_exclusive_group() -# test_group.add_argument('--include-test', action='append', metavar='TEST-NAME', -# help='Name of test to include') -# test_group.add_argument('--exclude-test', action='append', metavar='TEST-NAME', -# help='Name of test to exclude') -# type_group = test_group.add_mutually_exclusive_group() -# type_group.add_argument('--include-type', action='append', metavar='AMQP-TYPE', -# help='Name of AMQP type to include. Supported types:\n%s' % -# sorted(JmsMessageTypes.TYPE_MAP.keys())) - parser.add_argument('--exclude-type', action='append', metavar='JMS-MESSAGE-TYPE', - help='Name of JMS message type to exclude. Supported types:\n%s' % - sorted(JmsMessageTypes.TYPE_MAP.keys())) + parser.add_argument('--no-skip', action='store_true', + help='Do not skip tests that are excluded by default for reasons of a known bug') + type_group = parser.add_mutually_exclusive_group() + type_group.add_argument('--include-type', action='append', metavar='JMS_MESSAGE-TYPE', + help='Name of AMQP type to include. Supported types:\n%s' % + sorted(JmsMessageTypes.TYPE_MAP.keys())) + type_group.add_argument('--exclude-type', action='append', metavar='JMS_MESSAGE-TYPE', + help='Name of AMQP type to exclude. Supported types: see "include-type" above') shim_group = parser.add_mutually_exclusive_group() shim_group.add_argument('--include-shim', action='append', metavar='SHIM-NAME', - help='Name of shim to include. Supported shims:\n%s' % sorted(SHIM_MAP.keys())) + help='Name of shim to include. Supported shims:\n%s' % sorted(shim_map.keys())) shim_group.add_argument('--exclude-shim', action='append', metavar='SHIM-NAME', - help='Name of shim to exclude. Supported shims:\n%s' % sorted(SHIM_MAP.keys())) + help='Name of shim to exclude. Supported shims: see "include-shim" above') self.args = parser.parse_args() #--- Main program start --- if __name__ == '__main__': - ARGS = TestOptions().args + + PROTON_CPP_RECEIVER_SHIM = path.join(QPID_INTEROP_TEST_HOME, 'shims', 'qpid-proton-cpp', 'jms_messages_test', + 'Receiver') + PROTON_CPP_SENDER_SHIM = path.join(QPID_INTEROP_TEST_HOME, 'shims', 'qpid-proton-cpp', 'jms_messages_test', + 'Sender') + PROTON_PYTHON_RECEIVER_SHIM = path.join(QPID_INTEROP_TEST_HOME, 'shims', 'qpid-proton-python', 'jms_messages_test', + 'Receiver.py') + PROTON_PYTHON_SENDER_SHIM = path.join(QPID_INTEROP_TEST_HOME, 'shims', 'qpid-proton-python', 'jms_messages_test', + 'Sender.py') + QIT_JMS_CLASSPATH_FILE = path.join(QPID_INTEROP_TEST_HOME, 'shims', 'qpid-jms', 'cp.txt') + with open(QIT_JMS_CLASSPATH_FILE, 'r') as classpath_file: + QIT_JMS_CLASSPATH = classpath_file.read() + QPID_JMS_RECEIVER_SHIM = 'org.apache.qpid.interop_test.jms_messages_test.Receiver' + QPID_JMS_SENDER_SHIM = 'org.apache.qpid.interop_test.jms_messages_test.Sender' + + # SHIM_MAP contains an instance of each client language shim that is to be tested as a part of this test. For + # every shim in this list, a test is dynamically constructed which tests it against itself as well as every + # other shim in the list. + # + # As new shims are added, add them into this map to have them included in the test cases. + SHIM_MAP = {qpid_interop_test.shims.ProtonCppShim.NAME: \ + qpid_interop_test.shims.ProtonCppShim(PROTON_CPP_SENDER_SHIM, PROTON_CPP_RECEIVER_SHIM), + qpid_interop_test.shims.ProtonPythonShim.NAME: \ + qpid_interop_test.shims.ProtonPythonShim(PROTON_PYTHON_SENDER_SHIM, PROTON_PYTHON_RECEIVER_SHIM), + qpid_interop_test.shims.QpidJmsShim.NAME: \ + qpid_interop_test.shims.QpidJmsShim(QIT_JMS_CLASSPATH, QPID_JMS_SENDER_SHIM, QPID_JMS_RECEIVER_SHIM), + } + + ARGS = TestOptions(SHIM_MAP).args #print 'ARGS:', ARGS # debug + # Add shims included from the command-line + if ARGS.include_shim is not None: + new_shim_map = {} + for shim in ARGS.include_shim: + try: + new_shim_map[shim] = SHIM_MAP[shim] + except KeyError: + print 'No such shim: "%s". Use --help for valid shims' % shim + sys.exit(1) # Errors or failures present + SHIM_MAP = new_shim_map + # Remove shims excluded from the command-line + elif ARGS.exclude_shim is not None: + for shim in ARGS.exclude_shim: + try: + SHIM_MAP.pop(shim) + except KeyError: + print 'No such shim: "%s". Use --help for valid shims' % shim + sys.exit(1) # Errors or failures present + # Connect to broker to find broker type CONNECTION_PROPS = qpid_interop_test.broker_properties.get_broker_properties(ARGS.sender) if CONNECTION_PROPS is None: @@ -377,8 +392,10 @@ if __name__ == '__main__': print 'Test Broker: %s v.%s on %s' % (BROKER, BROKER_VERSION, BROKER_PLATFORM) print sys.stdout.flush() + if ARGS.no_skip: + BROKER = None # Will cause all tests to run - TYPES = JmsMessageTypes() + TYPES = JmsMessageTypes().get_types(ARGS) # TEST_CASE_CLASSES is a list that collects all the test classes that are constructed. One class is constructed # per AMQP type used as the key in map JmsMessageTypes.TYPE_MAP. @@ -388,25 +405,6 @@ if __name__ == '__main__': # type classes, each of which contains a test for the combinations of client shims TEST_SUITE = unittest.TestSuite() - # Add shims included from the command-line - if ARGS.include_shim is not None: - new_shim_map = {} - for shim in ARGS.include_shim: - try: - new_shim_map[shim] = SHIM_MAP[shim] - except KeyError: - print 'No such shim: "%s". Use --help for valid shims' % shim - sys.exit(1) # Errors or failures present - SHIM_MAP = new_shim_map - # Remove shims excluded from the command-line - elif ARGS.exclude_shim is not None: - for shim in ARGS.exclude_shim: - try: - SHIM_MAP.pop(shim) - except KeyError: - print 'No such shim: "%s". Use --help for valid shims' % shim - sys.exit(1) # Errors or failures present - # Create test classes dynamically for jmt in sorted(TYPES.get_type_list()): if ARGS.exclude_type is None or jmt not in ARGS.exclude_type: http://git-wip-us.apache.org/repos/asf/qpid-interop-test/blob/e622fa57/src/python/qpid_interop_test/test_type_map.py ---------------------------------------------------------------------- diff --git a/src/python/qpid_interop_test/test_type_map.py b/src/python/qpid_interop_test/test_type_map.py index 0fd4552..3d0bc65 100644 --- a/src/python/qpid_interop_test/test_type_map.py +++ b/src/python/qpid_interop_test/test_type_map.py @@ -20,6 +20,8 @@ Module containing Error classes for interop testing # under the License. # +import sys + class TestTypeMap(object): """ Class which contains all the described types and the test values to be used in testing against those types. @@ -59,6 +61,25 @@ class TestTypeMap(object): """Return a list of types which this test suite supports""" return self.TYPE_MAP.keys() + def get_types(self, args): + if args.include_type is not None: + new_type_map = {} + for type in args.include_type: + try: + new_type_map[type] = self.TYPE_MAP[type] + except KeyError: + print 'No such type: "%s". Use --help for valid types' % type + sys.exit(1) # Errors or failures present + self.TYPE_MAP = new_type_map + if args.exclude_type is not None: + for type in args.exclude_type: + try: + self.TYPE_MAP.pop(type) + except KeyError: + print 'No such type: "%s". Use --help for valid types' % type + sys.exit(1) # Errors or failures present + return self + def get_test_values(self, test_type): """Return test values to use when testing the supplied type.""" if test_type not in self.TYPE_MAP.keys(): --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
