Skip to content

Commit 2efc5fc

Browse files
author
Takashi Matsuo
authored
[btlr] testing: use NUM_TEST_WORKERS env var (#4030)
* [btlr] testing: use NUM_TEST_WORKERS env var * use 10 workers * wait 5 mins in py-3.8 presubmit build to avoid quota errors
1 parent fe463a3 commit 2efc5fc

File tree

4 files changed

+38
-2
lines changed

4 files changed

+38
-2
lines changed

.kokoro/python3.6/common.cfg

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,12 @@ env_vars: {
5151
value: "python-docs-samples-tests-py36"
5252
}
5353

54+
# Number of test workers.
55+
env_vars: {
56+
key: "NUM_TEST_WORKERS"
57+
value: "10"
58+
}
59+
5460
env_vars: {
5561
key: "TRAMPOLINE_DOCKERFILE"
5662
value: ".kokoro/docker/Dockerfile"

.kokoro/python3.7/common.cfg

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,12 @@ env_vars: {
5151
value: "python-docs-samples-tests-py37"
5252
}
5353

54+
# Number of test workers.
55+
env_vars: {
56+
key: "NUM_TEST_WORKERS"
57+
value: "10"
58+
}
59+
5460
env_vars: {
5561
key: "TRAMPOLINE_DOCKERFILE"
5662
value: ".kokoro/docker/Dockerfile"

.kokoro/python3.8/common.cfg

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,12 @@ env_vars: {
5151
value: "python-docs-samples-tests-py38"
5252
}
5353

54+
# Number of test workers.
55+
env_vars: {
56+
key: "NUM_TEST_WORKERS"
57+
value: "10"
58+
}
59+
5460
env_vars: {
5561
key: "TRAMPOLINE_DOCKERFILE"
5662
value: ".kokoro/docker/Dockerfile"

.kokoro/tests/run_tests.sh

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,19 @@ if [[ $* == *--only-diff-head* ]]; then
5151
fi
5252
fi
5353

54+
# Because Kokoro runs presubmit builds simalteneously, we often see
55+
# quota related errors. I think we can avoid this by changing the
56+
# order of tests to execute (e.g. reverse order for py-3.8
57+
# build). Currently there's no easy way to do that with btlr, so we
58+
# temporarily wait few minutes to avoid quota issue for py-3.8
59+
# presubmit build.
60+
if [[ "${RUN_TESTS_SESSION}" == "py-3.8" ]] \
61+
&& [[ "${KOKORO_JOB_NAME}" == *presubmit ]]; then
62+
echo -n "Detected py-3.8 presubmit build,"
63+
echo "Wait few minutes to avoid quota issues."
64+
sleep 5m
65+
fi
66+
5467
if [[ -z "${PROJECT_ROOT:-}" ]]; then
5568
PROJECT_ROOT="github/python-docs-samples"
5669
fi
@@ -108,10 +121,15 @@ test_prog="${PROJECT_ROOT}/.kokoro/tests/run_single_test.sh"
108121
btlr_args=(
109122
"run"
110123
"**/requirements.txt"
111-
"--max-concurrency"
112-
"30"
113124
)
114125

126+
if [[ -n "${NUM_TEST_WORKERS:-}" ]]; then
127+
btlr_args+=(
128+
"--max-concurrency"
129+
"${NUM_TEST_WORKERS}"
130+
)
131+
fi
132+
115133
if [[ -n "${DIFF_FROM:-}" ]]; then
116134
btlr_args+=(
117135
"--git-diff"

0 commit comments

Comments
 (0)