Skip to content

Commit e34b654

Browse files
committed
reverted systen test changes
1 parent 72503de commit e34b654

4 files changed

Lines changed: 6 additions & 141 deletions

File tree

.kokoro/continuous/common.cfg

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
action {
55
define_artifacts {
66
regex: "**/*sponge_log.xml"
7-
regex: "**/*sponge_log.log"
87
}
98
}
109

.kokoro/presubmit/common.cfg

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
action {
55
define_artifacts {
66
regex: "**/*sponge_log.xml"
7-
regex: "**/*sponge_log.log"
87
}
98
}
109

.kokoro/system-single.sh

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,4 @@ NOX_FILE_ARG=""
3232

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

35-
NOX_ARGS=()
36-
if [[ -n "${XML_OUTPUT_FILE}" ]]; then
37-
# Pass --junitxml as a positional argument to the underlying pytest call
38-
NOX_ARGS+=("--junitxml=${XML_OUTPUT_FILE}")
39-
fi
40-
41-
python3 -m nox ${NOX_SESSION_ARG} $NOX_FILE_ARG -- "${NOX_ARGS[@]}"
35+
python3 -m nox ${NOX_SESSION_ARG} $NOX_FILE_ARG

.kokoro/system.sh

Lines changed: 5 additions & 132 deletions
Original file line numberDiff line numberDiff line change
@@ -38,18 +38,7 @@ pwd
3838
run_package_test() {
3939
local package_name=$1
4040
local package_path="packages/${package_name}"
41-
42-
# Create a dedicated directory for this package's artifacts
43-
local artifact_dir="${KOKORO_ARTIFACTS_DIR}/${package_name}"
44-
mkdir -p "${artifact_dir}"
45-
46-
# Define standard output paths for logs and XML results
47-
export XML_OUTPUT_FILE="${artifact_dir}/sponge_log.xml"
48-
local log_file="${artifact_dir}/sponge_log.log"
49-
50-
# Isolate gcloud config for parallel execution
51-
export CLOUDSDK_CONFIG=$(mktemp -d)
52-
41+
5342
# Declare local overrides to prevent bleeding into the next loop iteration
5443
local PROJECT_ID
5544
local GOOGLE_APPLICATION_CREDENTIALS
@@ -59,8 +48,6 @@ run_package_test() {
5948

6049
echo "------------------------------------------------------------"
6150
echo "Configuring environment for: ${package_name}"
62-
echo "Log file: ${log_file}"
63-
echo "XML results: ${XML_OUTPUT_FILE}"
6451
echo "------------------------------------------------------------"
6552

6653
case "${package_name}" in
@@ -95,86 +82,17 @@ run_package_test() {
9582
# Run the actual test
9683
pushd "${package_path}" > /dev/null
9784
set +e
98-
# *** CRITICAL: system-single.sh MUST use XML_OUTPUT_FILE to generate the JUnit XML ***
99-
"${system_test_script}" > "${log_file}" 2>&1
85+
"${system_test_script}"
10086
local res=$?
10187
set -e
10288
popd > /dev/null
103-
104-
# Clean up isolated gcloud config
105-
rm -rf "${CLOUDSDK_CONFIG}"
106-
89+
10790
return $res
10891
}
10992

11093
# A file for running system tests
11194
system_test_script="${PROJECT_ROOT}/.kokoro/system-single.sh"
112-
# Ensure KOKORO_ARTIFACTS_DIR is set, fallback to a local directory
113-
export KOKORO_ARTIFACTS_DIR="${KOKORO_ARTIFACTS_DIR:-${PROJECT_ROOT}/.artifacts}"
114-
115-
# Parallel execution settings
116-
MAX_PARALLEL=4
117-
running_pids=()
118-
declare -A pid_to_pkg
119-
declare -A pid_to_resfile
120-
121-
# Array to keep track of results for the final summary
122-
results=()
123-
handle_finished_job() {
124-
local pid=$1
125-
local pkg=${pid_to_pkg[$pid]}
126-
local resfile=${pid_to_resfile[$pid]}
127-
local pkg_log="${KOKORO_ARTIFACTS_DIR}/${pkg}/sponge_log.log"
128-
129-
# wait $pid might fail if it was already reaped by wait -n,
130-
# so we ignore its exit code and use the resfile.
131-
wait "$pid" 2>/dev/null || true
132-
133-
local res=1
134-
if [ -s "$resfile" ]; then
135-
res=$(cat "$resfile")
136-
rm "$resfile"
137-
else
138-
# If the file is empty or missing, the subshell crashed early
139-
res=1
140-
fi
141-
142-
echo "============================================================"
143-
echo "System tests for ${pkg} finished (Exit code: ${res})"
144-
echo "Artifacts in: ${KOKORO_ARTIFACTS_DIR}/${pkg}"
145-
echo "============================================================"
14695

147-
# Print the package log to the console
148-
if [ -f "${pkg_log}" ]; then
149-
echo "--- Start of Logs for ${pkg} ---"
150-
cat "${pkg_log}"
151-
echo "--- End of Logs for ${pkg} ---"
152-
else
153-
echo "Console Fallback Warning: Log file not found at ${pkg_log}"
154-
fi
155-
echo ""
156-
157-
if [ -z "${res}" ] || [ "${res}" -ne 0 ]; then
158-
echo "============================================================"
159-
echo "FAIL-FAST: System tests for ${pkg} failed!"
160-
echo "Cancelling all remaining running background jobs..."
161-
echo "============================================================"
162-
163-
# Kill all other active background processes
164-
for active_pid in "${running_pids[@]}"; do
165-
if [ "$active_pid" != "$pid" ] && kill -0 "$active_pid" 2>/dev/null; then
166-
pkg_to_cancel=${pid_to_pkg[$active_pid]}
167-
echo "Cancelling active system tests for ${pkg_to_cancel} (PID: ${active_pid})..."
168-
# Send SIGTERM to allow graceful cleanup of resources if possible, or SIGKILL
169-
kill -9 "$active_pid" 2>/dev/null || true
170-
fi
171-
done
172-
173-
exit "${res}"
174-
else
175-
results+=("${pkg}: PASSED")
176-
fi
177-
}
17896
# Run system tests for each package with directory packages/*/tests/system
17997
for path in `find 'packages' \
18098
\( -type d -wholename 'packages/*/tests/system' \) -o \
@@ -222,55 +140,10 @@ for path in `find 'packages' \
222140
set -e
223141

224142
if [[ "${package_modified}" -gt 0 || "$KOKORO_BUILD_ARTIFACTS_SUBDIR" == *"continuous"* ]]; then
225-
# Wait if we have reached MAX_PARALLEL
226-
while [[ ${#running_pids[@]} -ge $MAX_PARALLEL ]]; do
227-
set +e
228-
wait -n
229-
set -e
230-
# Find which job finished
231-
new_pids=()
232-
for pid in "${running_pids[@]}"; do
233-
if kill -0 "$pid" 2>/dev/null; then
234-
new_pids+=("$pid")
235-
else
236-
handle_finished_job "$pid"
237-
fi
238-
done
239-
running_pids=("${new_pids[@]}")
240-
done
241-
242-
# Start the next test in the background
243-
res_file=$(mktemp)
244-
(
245-
if run_package_test "$package_name"; then
246-
echo 0 > "$res_file"
247-
else
248-
res=$?
249-
echo $res > "$res_file"
250-
fi
251-
) &
252-
pid=$!
253-
running_pids+=($pid)
254-
pid_to_pkg[$pid]=$package_name
255-
pid_to_resfile[$pid]=$res_file
256-
echo "Started system tests for ${package_name} (PID: ${pid})"
143+
# Call the function - its internal exports won't affect the next loop
144+
run_package_test "$package_name" || RETVAL=$?
257145
else
258146
echo "No changes in ${package_name} and not a continuous build, skipping."
259147
fi
260148
done
261-
262-
# Wait for all remaining jobs
263-
for pid in "${running_pids[@]}"; do
264-
handle_finished_job "$pid"
265-
done
266-
267-
echo "------------------------------------------------------------"
268-
echo "System Test Summary"
269-
echo "------------------------------------------------------------"
270-
for res in "${results[@]}"; do
271-
echo "$res"
272-
done
273-
echo "------------------------------------------------------------"
274-
275149
exit ${RETVAL}
276-

0 commit comments

Comments
 (0)