Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion scripts/functions-server.sh
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,10 @@ run_with_functions_server() { # run_with_functions_server <command...>
[[ "$server_status" == 0 ]] && return 1
return "$server_status"
fi
if [[ "$command_status" != 0 ]]; then
echo "Monitored command exited with status $command_status. Function server log:" >&2
cat "$FUNCTIONS_SERVER_LOG" >&2 || true
fi
return "$command_status"
}

Expand Down Expand Up @@ -355,8 +359,15 @@ self_test() {

begin_server bash -c 'echo "Serving functions on http://127.0.0.1:9999/functions/v1/x"; exec sleep 30'
expect_status "suite failure status survives" 0 wait_for_functions_server
echo 'worker failure diagnostic' >>"$FUNCTIONS_SERVER_LOG"
expect_status "suite failure returns its status" 11 \
run_with_functions_server bash -c 'exit 11'
run_with_functions_server bash -c 'exit 11' 2>"$tmp/suite-stderr"
expect_status "suite failure includes the function server log" 0 \
grep -qx 'worker failure diagnostic' "$tmp/suite-stderr"
expect_status "successful suite returns zero" 0 \
run_with_functions_server bash -c 'exit 0' 2>"$tmp/success-stderr"
expect_status "successful suite does not dump the function server log" 0 \
test ! -s "$tmp/success-stderr"
stop_functions_server

: >"$tmp/docker-calls"
Expand Down
Loading