@@ -31,18 +31,8 @@ def get_test_info(test_type):
31
31
return test_info .get (test_type )
32
32
33
33
34
- def main ():
35
- """Run the ducktape test based on specified type"""
36
- parser = argparse .ArgumentParser (description = "Confluent Kafka Python - Ducktape Test Runner" )
37
- parser .add_argument ('test_type' , choices = ['producer' , 'consumer' , 'producer_sr' ],
38
- help = 'Type of test to run' )
39
- parser .add_argument ('test_method' , nargs = '?' ,
40
- help = 'Specific test method to run (optional)' )
41
- parser .add_argument ('--debug' , action = 'store_true' ,
42
- help = 'Enable debug output' )
43
-
44
- args = parser .parse_args ()
45
-
34
+ def run_single_test_type (args ):
35
+ """Run a single test type"""
46
36
test_info = get_test_info (args .test_type )
47
37
48
38
# Header
@@ -137,5 +127,61 @@ def main():
137
127
return 1
138
128
139
129
130
+ def run_all_tests (args ):
131
+ """Run all available test types"""
132
+ test_types = ['producer' , 'consumer' , 'producer_sr' ]
133
+ overall_success = True
134
+
135
+ print ("Confluent Kafka Python - All Ducktape Tests" )
136
+ print (f"Timestamp: { datetime .now ().isoformat ()} " )
137
+ print ("=" * 70 )
138
+
139
+ for test_type in test_types :
140
+ print (f"\n { '=' * 20 } Running { test_type .upper ()} Tests { '=' * 20 } " )
141
+
142
+ # Create a new args object for this test type
143
+ test_args = argparse .Namespace (
144
+ test_type = test_type ,
145
+ test_method = args .test_method ,
146
+ debug = args .debug
147
+ )
148
+
149
+ # Run the specific test type
150
+ result = run_single_test_type (test_args )
151
+ if result != 0 :
152
+ overall_success = False
153
+ print (f"\n ❌ { test_type .upper ()} tests failed!" )
154
+ else :
155
+ print (f"\n ✅ { test_type .upper ()} tests passed!" )
156
+
157
+ print (f"\n { '=' * 70 } " )
158
+ if overall_success :
159
+ print ("🎉 All tests completed successfully!" )
160
+ return 0
161
+ else :
162
+ print ("💥 Some tests failed. Check the output above for details." )
163
+ return 1
164
+
165
+
166
+ def main ():
167
+ """Run the ducktape test based on specified type"""
168
+ parser = argparse .ArgumentParser (description = "Confluent Kafka Python - Ducktape Test Runner" )
169
+ parser .add_argument ('test_type' , nargs = '?' , choices = ['producer' , 'consumer' , 'producer_sr' ],
170
+ help = 'Type of test to run (default: run all tests)' )
171
+ parser .add_argument ('test_method' , nargs = '?' ,
172
+ help = 'Specific test method to run (optional)' )
173
+ parser .add_argument ('--debug' , action = 'store_true' ,
174
+ help = 'Enable debug output' )
175
+
176
+ args = parser .parse_args ()
177
+
178
+ # If no test_type provided, run all tests
179
+ if args .test_type is None :
180
+ return run_all_tests (args )
181
+
182
+ # Run single test type
183
+ return run_single_test_type (args )
184
+
185
+
140
186
if __name__ == "__main__" :
141
- sys .exit (main ())
187
+ sys .exit (main ())
0 commit comments