@@ -320,29 +320,23 @@ lane :test_e2e_mock do |options|
320320 number_of_retries : 3
321321 }
322322
323- if is_localhost
324- scan ( scan_options )
325- else
326- parallelize_tests_on_ci ( scan : scan_options , batch : options [ :batch ] , cron : options [ :cron ] )
323+ unless is_localhost || options [ :cron ]
324+ products_dir = File . expand_path ( "../#{ derived_data_path } /Build/Products" )
325+ xctestrun = Dir . glob ( File . expand_path ( "#{ products_dir } /*.xctestrun" ) ) . first
326+ tests = retrieve_xctest_names ( xctestrun : xctestrun ) . values . flatten
327+ slice_size = ( tests . size / ENV [ 'MATRIX_SIZE' ] . to_f ) . ceil
328+ only_testing = [ ]
329+ tests . each_slice ( slice_size ) { |test | only_testing << test }
330+ only_testing_batch = only_testing [ options [ :batch ] . to_i ]
331+ scan_options [ :only_testing ] = only_testing_batch
327332 end
328- end
329-
330- private_lane :parallelize_tests_on_ci do |options |
331- products_dir = File . expand_path ( "../#{ derived_data_path } /Build/Products" )
332- xctestrun = Dir . glob ( File . expand_path ( "#{ products_dir } /*.xctestrun" ) ) . first
333- tests = retrieve_xctest_names ( xctestrun : xctestrun ) . values . flatten
334- slice_size = options [ :cron ] ? tests . size : ( tests . size / ENV [ 'MATRIX_SIZE' ] . to_f ) . ceil
335- only_testing = [ ]
336- tests . each_slice ( slice_size ) { |test | only_testing << test }
337- only_testing_batch = only_testing [ options [ :batch ] . to_i ]
338333
339334 begin
340- UI . success ( "Tests in total: #{ only_testing . flatten . size } . Running #{ only_testing_batch . size } of them ⌛️" )
341- scan ( options [ :scan ] . merge ( only_testing : only_testing_batch ) )
335+ scan ( scan_options )
342336 rescue StandardError
343337 failed_tests = retreive_failed_tests
344338 UI . important ( "Re-running #{ failed_tests . size } failed tests ⌛️" )
345- scan ( options [ :scan ] . merge ( only_testing : failed_tests ) )
339+ scan ( scan_options . merge ( only_testing : failed_tests ) )
346340 end
347341end
348342
0 commit comments