66import json
77from collections import defaultdict
88
9- def should_run_service (services ):
10- service_ids = os .environ .get ('AWS_SMOKE_TEST_SERVICE_IDS' , '' )
11- print ("AWS_SMOKE_TEST_SERVICE_IDS:" ,service_ids )
12- if not service_ids :
13- return services
14- allowed_services = service_ids .split (',' )
15- return [service for service in services if service in allowed_services ]
16-
179def main ():
1810 parser = argparse .ArgumentParser (description = 'Run smoke tests' )
1911 parser .add_argument ('--testDir' , default = './build' , help = 'Path to build directory' )
@@ -37,14 +29,19 @@ def main():
3729 total_tests = 0
3830 all_results = defaultdict (list )
3931
40- services = should_run_service (services )
32+ service_ids = os .environ .get ('AWS_SMOKE_TEST_SERVICE_IDS' , '' )
33+ if not service_ids :
34+ return 0
35+ allowed_services = service_ids .split (',' )
36+ allowed_services = [s .strip ().lower ().replace (' ' , '-' ) for s in allowed_services ] # Convert uppercase to lowercase and spaces to hyphens
37+ services = [service for service in services if service in allowed_services ]
4138
4239 for service in services :
4340 executable = os .path .join (smoke_tests_dir , service , f"{ service } -smoke-tests" )
4441
4542 with tempfile .NamedTemporaryFile (mode = 'w+' , suffix = '.json' ) as temp_file :
4643 json_output_path = temp_file .name
47- temp_file .close () # Close it so other processes can write to it
44+ temp_file .close ()
4845 test_command = [executable , f'--gtest_output=json:{ json_output_path } ' ]
4946 subprocess .run (test_command , stdout = subprocess .DEVNULL , stderr = subprocess .DEVNULL )
5047
0 commit comments