49
49
# Confluent schema-registry
50
50
schema_registry_url = None
51
51
52
- # Topic to use
52
+ # Topic prefix to use
53
53
topic = 'test'
54
54
55
55
# API version requests are only implemented in Kafka broker >=0.10
@@ -962,35 +962,37 @@ def verify_admin():
962
962
if error is not None :
963
963
raise error
964
964
965
+
966
+ all_modes = ['consumer' , 'producer' , 'avro' , 'performance' , 'admin' , 'none' ]
967
+ """All test modes"""
968
+
969
+
965
970
def print_usage (exitcode , reason = None ):
966
971
""" Print usage and exit with exitcode """
967
972
if reason is not None :
968
973
print ('Error: %s' % reason )
969
- print ('Usage: %s <broker> [opts] [<topic>] [<schema_registry>]' % sys .argv [0 ])
974
+ print ('Usage: %s [options] <broker> [<topic>] [<schema_registry>]' % sys .argv [0 ])
970
975
print ('Options:' )
971
- print (' --consumer, --producer, --avro, --performance - limit to matching tests' )
976
+ print (' %s - limit to matching tests' % ', ' . join ([ '--' + x for x in all_modes ]) )
972
977
973
978
sys .exit (exitcode )
974
979
975
980
976
- def run ():
977
- """Run integration tests"""
981
+ if __name__ == '__main__' :
982
+ """Run test suites"""
983
+
984
+ if with_pympler :
985
+ tr = tracker .SummaryTracker ()
986
+ print ('Running with pympler memory tracker' )
978
987
979
988
modes = list ()
980
989
981
990
# Parse options
982
991
while len (sys .argv ) > 1 and sys .argv [1 ].startswith ('--' ):
983
- opt = sys .argv .pop (1 )
984
- if opt == '--consumer' :
985
- modes .append ('consumer' )
986
- elif opt == '--producer' :
987
- modes .append ('producer' )
988
- elif opt == '--avro' :
989
- modes .append ('avro' )
990
- elif opt == '--performance' :
991
- modes .append ('performance' )
992
- else :
993
- print_usage (1 , 'unknown option ' + opt )
992
+ opt = sys .argv .pop (1 )[2 :]
993
+ if opt not in all_modes :
994
+ print_usage (1 , 'unknown option --' + opt )
995
+ modes .append (opt )
994
996
995
997
if len (sys .argv ) > 1 :
996
998
bootstrap_servers = sys .argv [1 ]
@@ -1002,10 +1004,13 @@ def run():
1002
1004
print_usage (1 )
1003
1005
1004
1006
if len (modes ) == 0 :
1005
- modes = [ 'consumer' , 'producer' , 'avro' , 'performance' ]
1007
+ modes = all_modes
1006
1008
1007
1009
print ('Using confluent_kafka module version %s (0x%x)' % confluent_kafka .version ())
1008
1010
print ('Using librdkafka version %s (0x%x)' % confluent_kafka .libversion ())
1011
+ print ('Testing: %s' % modes )
1012
+ print ('Brokers: %s' % bootstrap_servers )
1013
+ print ('Topic prefix: %s' % topic )
1009
1014
1010
1015
if 'producer' in modes :
1011
1016
print ('=' * 30 , 'Verifying Producer' , '=' * 30 )
@@ -1047,15 +1052,6 @@ def run():
1047
1052
1048
1053
print ('=' * 30 , 'Done' , '=' * 30 )
1049
1054
1050
-
1051
- if __name__ == '__main__' :
1052
- if with_pympler :
1053
- tr = tracker .SummaryTracker ()
1054
- print ('Running with pympler memory tracker' )
1055
-
1056
- # Run tests
1057
- run ()
1058
-
1059
1055
if with_pympler :
1060
1056
gc .collect ()
1061
1057
print ('Memory tracker results' )
0 commit comments