Skip to content

Commit b516f54

Browse files
Running more tests in parallel for faster presubmit outcome (#1256)
Now the tests finish < 2 hours for 2.1-deb11 which were earlier timing out in 4 hours, so atleast 2x faster. kubectl run doesn't allow specifying CPU/Memory requirements in single line. The test cluster uses Autopilot so resources will be used only when tests are run.
1 parent 2d3d53a commit b516f54

File tree

2 files changed

+28
-9
lines changed

2 files changed

+28
-9
lines changed

cloudbuild/presubmit.sh

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,6 @@ determine_tests_to_run() {
7070
changed_dir="${changed_dir%%/*}/"
7171
# Run all tests if common directories modified
7272
if [[ ${changed_dir} =~ ^(integration_tests|util|cloudbuild)/$ ]]; then
73-
continue # remove this before squash/merge
7473
echo "All tests will be run: '${changed_dir}' was changed"
7574
TESTS_TO_RUN=(":DataprocInitActionsTestSuite")
7675
return 0
@@ -101,13 +100,13 @@ determine_tests_to_run() {
101100
}
102101

103102
run_tests() {
104-
local -r max_parallel_tests=10
103+
local -r max_parallel_tests=20
105104
bazel test \
106105
--jobs="${max_parallel_tests}" \
107106
--local_test_jobs="${max_parallel_tests}" \
108107
--flaky_test_attempts=3 \
109108
--action_env="INTERNAL_IP_SSH=true" \
110-
--test_output="errors" \
109+
--test_output="all" \
111110
--noshow_progress \
112111
--noshow_loading_progress \
113112
--test_arg="--image_version=${IMAGE_VERSION}" \

cloudbuild/run-presubmit-on-k8s.sh

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,32 @@ LOGS_SINCE_TIME=$(date --iso-8601=seconds)
1414

1515
# This kubectl sometimes fails because services have not caught up. Thread.yield()
1616
sleep 10s
17-
kubectl run "${POD_NAME}" \
18-
--image="${IMAGE}" \
19-
--restart=Never \
20-
--env="COMMIT_SHA=${COMMIT_SHA}" \
21-
--env="IMAGE_VERSION=${DATAPROC_IMAGE_VERSION}" \
22-
--command -- bash /init-actions/cloudbuild/presubmit.sh
17+
18+
readonly POD_CONFIG="pod.yaml"
19+
cat >$POD_CONFIG <<EOF
20+
apiVersion: v1
21+
kind: Pod
22+
metadata:
23+
name: "${POD_NAME}"
24+
spec:
25+
restartPolicy: Never
26+
containers:
27+
- name: "dataproc-test-runner"
28+
image: "${IMAGE}"
29+
resources:
30+
requests:
31+
memory: "4G"
32+
cpu: "6000m"
33+
env:
34+
- name: COMMIT_SHA
35+
value: "${COMMIT_SHA}"
36+
- name: IMAGE_VERSION
37+
value: "${DATAPROC_IMAGE_VERSION}"
38+
command: ["bash"]
39+
args: ["/init-actions/cloudbuild/presubmit.sh"]
40+
EOF
41+
42+
kubectl apply -f $POD_CONFIG
2343

2444
# Delete POD on exit and describe it before deletion if exit was unsuccessful
2545
trap '[[ $? != 0 ]] && kubectl describe "pod/${POD_NAME}"; kubectl delete pods "${POD_NAME}"' EXIT

0 commit comments

Comments
 (0)