@@ -47,6 +47,10 @@ Examples:
4747 created if it doesn't exist and will not be deleted when the tests end.
4848
4949 ./scripts/run-tests --test-suite smoke-latest --namespace smoke
50+
51+ 6. Run the smoke test suite and produce a JUnit test report.
52+
53+ ./scripts/run-tests --report xml
5054"""
5155
5256
@@ -136,6 +140,13 @@ def parse_args(argv: list[str]) -> argparse.Namespace:
136140 required = False ,
137141 )
138142
143+ parser .add_argument (
144+ "--report" ,
145+ help = "Produce a JUnit Test Report (xml or json)" ,
146+ type = str ,
147+ required = False ,
148+ )
149+
139150 return parser .parse_args (argv )
140151
141152
@@ -339,7 +350,7 @@ def gen_tests(test_suite: str) -> None:
339350 raise TestRunnerException ()
340351
341352
342- def run_tests (test : str , parallel : int , namespace : str , skip_delete : bool ) -> None :
353+ def run_tests (test : str , parallel : int , namespace : str , skip_delete : bool , report : str ) -> None :
343354 try :
344355 kuttl_cmd = ["kubectl-kuttl" , "test" ]
345356 if test :
@@ -367,6 +378,8 @@ def run_tests(test: str, parallel: int, namespace: str, skip_delete: bool) -> No
367378 logging .error (stderr )
368379 logging .error ("namespace creation failed" )
369380 raise TestRunnerException ()
381+ if report :
382+ kuttl_cmd .extend (["--report" , report ])
370383
371384 logging .debug (f"Running : { kuttl_cmd } " )
372385
@@ -392,7 +405,7 @@ def main(argv) -> int:
392405 if opts .skip_tests :
393406 logging .info ("Skip running tests." )
394407 else :
395- run_tests (opts .test , opts .parallel , opts .namespace , opts .skip_delete )
408+ run_tests (opts .test , opts .parallel , opts .namespace , opts .skip_delete , opts . report )
396409 except TestRunnerException :
397410 ret = 1
398411 return ret
0 commit comments