fix(e2e): bound docker failure log printing

This commit is contained in:
Vincent Koc
2026-06-07 07:29:35 +02:00
parent 0b0893aa21
commit 6590f764b5
6 changed files with 70 additions and 6 deletions
+1 -1
View File
@@ -77,7 +77,7 @@ wait "$docker_pid"
run_status="$?"
set -e
cat "$RUN_LOG"
docker_e2e_print_log "$RUN_LOG"
if [ "$run_status" -eq 0 ]; then
node scripts/e2e/lib/docker-stats/assert-resource-ceiling.mjs "$STATS_LOG" "$MAX_MEMORY_MIB" "$MAX_CPU_PERCENT" kitchen-sink
+1 -1
View File
@@ -66,7 +66,7 @@ wait "$docker_pid"
run_status="$?"
set -e
cat "$RUN_LOG"
docker_e2e_print_log "$RUN_LOG"
if [ "$run_status" -eq 0 ]; then
node scripts/e2e/lib/docker-stats/assert-resource-ceiling.mjs "$STATS_LOG" "$MAX_MEMORY_MIB" "$MAX_CPU_PERCENT" kitchen-sink-rpc
+28 -3
View File
@@ -37,16 +37,41 @@ if [[ "$KITCHEN_SINK_SWEEP_SOURCE_ONLY" != "1" ]]; then
openclaw_e2e_eval_test_state_from_b64 "${OPENCLAW_TEST_STATE_SCRIPT_B64:?missing OPENCLAW_TEST_STATE_SCRIPT_B64}"
fi
print_kitchen_sink_log() {
local log_file="$1"
local max_bytes="${OPENCLAW_DOCKER_E2E_LOG_PRINT_BYTES:-65536}"
if ! [[ "$max_bytes" =~ ^[0-9]+$ ]] || [ "$max_bytes" -lt 1 ]; then
max_bytes="65536"
else
max_bytes="$((10#$max_bytes))"
fi
if [ ! -f "$log_file" ]; then
return 0
fi
local log_bytes
log_bytes="$(wc -c <"$log_file" 2>/dev/null || echo 0)"
log_bytes="${log_bytes//[[:space:]]/}"
if ! [[ "$log_bytes" =~ ^[0-9]+$ ]]; then
log_bytes="0"
fi
if [ "$log_bytes" -le "$max_bytes" ]; then
cat "$log_file"
return 0
fi
echo "--- ${log_file} truncated: showing last ${max_bytes} of ${log_bytes} bytes ---"
tail -c "$max_bytes" "$log_file"
}
run_kitchen_sink_openclaw_logged() {
local label="$1"
shift
local safe_label="${label//[^[:alnum:]._-]/_}"
local log_file="${KITCHEN_SINK_TMP_DIR}/${safe_label}.log"
if ! openclaw_e2e_maybe_timeout "$KITCHEN_SINK_CLI_TIMEOUT" node "$OPENCLAW_ENTRY" "$@" >"$log_file" 2>&1; then
cat "$log_file"
print_kitchen_sink_log "$log_file"
return 1
fi
cat "$log_file"
print_kitchen_sink_log "$log_file"
}
run_kitchen_sink_openclaw_capture() {
@@ -64,7 +89,7 @@ run_expect_failure() {
"$@" >"$output_file" 2>&1
local status="$?"
set -e
cat "$output_file"
print_kitchen_sink_log "$output_file"
if [ "$status" -eq 0 ]; then
echo "Expected ${label} to fail, but it succeeded." >&2
exit 1
+1 -1
View File
@@ -43,7 +43,7 @@ wait "$docker_pid"
run_status="$?"
set -e
cat "$RUN_LOG"
docker_e2e_print_log "$RUN_LOG"
if [ "$run_status" -eq 0 ]; then
node scripts/e2e/lib/docker-stats/assert-resource-ceiling.mjs "$STATS_LOG" "$MAX_MEMORY_MIB" "$MAX_CPU_PERCENT" onboard