Fix issue with balanced tests (#1384)
This commit is contained in:
@@ -90,7 +90,7 @@ runs:
|
||||
max_test_time_as_int=$(printf "%.0f\n" "$max_test_time")
|
||||
echo "max test time : $max_test_time_as_int"
|
||||
|
||||
number_of_instances=$(( $sum_of_all_tests_as_int / $max_test_time_as_int ))
|
||||
number_of_instances=${NUMBER_OF_JOBS}
|
||||
echo "number of instances $number_of_instances"
|
||||
|
||||
average_time_per_instance=$(( sum_of_all_tests_as_int / number_of_instances ))
|
||||
@@ -133,6 +133,15 @@ runs:
|
||||
echo "current index : ${CURRENT_INDEX}"
|
||||
tests_to_run_in_current_index=$tests_to_take_in_current_iteration
|
||||
echo "time of tests in current index : $sum"
|
||||
|
||||
# this can be the case when we delete some tests in some PR for example
|
||||
# the previous cache will contain more tests then we currently have, so some
|
||||
# matrix instances will have no tests to run
|
||||
if [[ "$sum" -eq "0" ]]; then
|
||||
echo "no tests to run in current index, most probably this PR removed some tests"
|
||||
tests_to_run_in_current_index='none'
|
||||
fi
|
||||
|
||||
fi
|
||||
|
||||
done
|
||||
@@ -188,13 +197,18 @@ runs:
|
||||
unset IFS
|
||||
|
||||
for i in "${sliced_array[@]}"; do
|
||||
filename="${i}.txt"
|
||||
echo "searching for filename: ${filename}"
|
||||
file=$(find . -name "${filename}")
|
||||
echo "found file: ${file}"
|
||||
result=$(cat "${file}" | grep 'elapsed' | awk '{print $12, $13}')
|
||||
|
||||
echo "run test: ${i} in : ${result}" >> /tmp/test_times_${{ env.CURRENT_INDEX }}.txt
|
||||
|
||||
# can be present in the last index as 'none,testA,testB'
|
||||
if [[ "$i" -eq "none" ]]; then
|
||||
echo "skipping 'none'"
|
||||
else
|
||||
filename="${i}.txt"
|
||||
echo "searching for filename: ${filename}"
|
||||
file=$(find . -name "${filename}")
|
||||
echo "found file: ${file}"
|
||||
result=$(cat "${file}" | grep 'elapsed' | awk '{print $12, $13}')
|
||||
echo "run test: ${i} in : ${result}" >> /tmp/test_times_${{ env.CURRENT_INDEX }}.txt
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
|
||||
1
.github/workflows/maven.yaml
vendored
1
.github/workflows/maven.yaml
vendored
@@ -123,6 +123,7 @@ jobs:
|
||||
SEGMENT_DOWNLOAD_TIMEOUT_MINS: 30
|
||||
# only run this one if there is a previous cache of test times
|
||||
if: needs.build.outputs.test_times_cache_present == 'true'
|
||||
timeout-minutes: 60
|
||||
|
||||
strategy:
|
||||
fail-fast: true
|
||||
|
||||
Reference in New Issue
Block a user