Skip to content

Commit 9aa84fd

Browse files
committed
update system test execution
1 parent 25c17e9 commit 9aa84fd

2 files changed

Lines changed: 39 additions & 5 deletions

File tree

.kokoro/system-single.sh

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,17 @@ NOX_FILE_ARG=""
3232

3333
[[ -z "${NOX_FILE}" ]] || NOX_FILE_ARG="-f ${NOX_FILE}"
3434

35-
python3 -m nox ${NOX_SESSION_ARG} $NOX_FILE_ARG
35+
python3 -m pip install uv
36+
for attempt in 1 2 3; do
37+
echo "Execution attempt $attempt of 3..."
38+
if uvx --with 'nox[uv]' nox ${NOX_SESSION_ARG} $NOX_FILE_ARG; then
39+
echo "Tests passed successfully!"
40+
exit 0
41+
fi
42+
43+
echo "Tests failed. Backing off for 15 seconds..."
44+
sleep 15
45+
done
46+
47+
echo "Tests failed after 3 attempts. Hard failure."
48+
exit 1

.kokoro/system.sh

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,8 @@ system_test_script="${PROJECT_ROOT}/.kokoro/system-single.sh"
117117
packages_with_system_tests_pattern=$(printf "|*%s*" "${packages_with_system_tests[@]}")
118118
packages_with_system_tests_pattern="${packages_with_system_tests_pattern:1}" # Remove the leading pipe
119119

120+
declare -A pids
121+
120122
# Run system tests for each package with directory packages/*/tests/system
121123
for path in `find 'packages' \
122124
\( -type d -wholename 'packages/*/tests/system' \) -o \
@@ -141,11 +143,30 @@ for path in `find 'packages' \
141143
package_modified=$(git diff "${KOKORO_GITHUB_PULL_REQUEST_TARGET_BRANCH}...${KOKORO_GITHUB_PULL_REQUEST_COMMIT}" -- ${files_to_check} | wc -l)
142144
set -e
143145

144-
if [[ "${package_modified}" -gt 0 || "$KOKORO_BUILD_ARTIFACTS_SUBDIR" == *"continuous"* ]]; then
145-
# Call the function - its internal exports won't affect the next loop
146-
run_package_test "$package_name" || RETVAL=$?
146+
if [[ "${package_modified}" -gt 0 || "$KOKORO_BUILD_ARTIFACTS_SUBDIR" == *"continuous"* ]]; then
147+
echo ">>> Dispatching ${package_name} in the background <<<"
148+
149+
# Execute inside an isolated subshell ( ) to prevent GCP credential collisions
150+
(
151+
run_package_test "$package_name"
152+
) &
153+
154+
# Capture the PID of the subshell
155+
pids["$package_name"]=$!
147156
else
148157
echo "No changes in ${package_name} and not a continuous build, skipping."
149158
fi
150159
done
151-
exit ${RETVAL}
160+
161+
echo "============================================================"
162+
echo "Waiting for all concurrent system tests to complete..."
163+
echo "============================================================"
164+
165+
for package in "${!pids[@]}"; do
166+
wait ${pids[$package]} || {
167+
echo "ERROR: System tests failed for $package"
168+
RETVAL=1
169+
}
170+
done
171+
172+
exit ${RETVAL}

0 commit comments

Comments
 (0)