Skip to content
This repository has been archived by the owner on Jun 28, 2024. It is now read-only.

ci.ocp: Improve the service-up detection #5807

Merged
merged 2 commits into from
Feb 22, 2024
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
22 changes: 16 additions & 6 deletions .ci/openshift-ci/run_smoke_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -57,16 +57,26 @@ else
fi

info "Wait for the HTTP server to respond"
rm -f hello_msg.txt
waitForProcess 60 1 "curl '${host}:${port}${hello_file}' -s -o hello_msg.txt"

grep "${hello_msg}" hello_msg.txt > /dev/null
test_status=$?
if [ $test_status -eq 0 ]; then
tempfile=$(mktemp)
check_cmd="curl -vvv '${host}:${port}${hello_file}' 2>&1 | tee -a '$tempfile' | grep -q '$hello_msg'"
if waitForProcess 60 1 "${check_cmd}"; then
test_status=0
info "HTTP server is working"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd leave out "everything is working" messages from the log if possible.
You're going to check logs when things do not work and the "working" logs get in the way.
If you can't tell where things break in the code, you're typically missing an error test

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, this message was already there (and is quite useful when looking for things that do not work, at least you know this thing worked...). Anyway I'd rather move a discussion about this message to another PR, if needed.

else
test_status=1
echo "::error:: HTTP server not working"
gkurz marked this conversation as resolved.
Show resolved Hide resolved
echo "::group::Output of the \"curl -vvv '${host}:${port}${hello_file}'\""
cat "${tempfile}"
echo "::endgroup::"
echo "::group::Describe kube-system namespace"
oc describe -n kube-system all
echo "::endgroup::"
echo "::group::Descibe current namespace"
oc describe all
echo "::endgroup::"
info "HTTP server is unreachable"
fi
rm -f "$tempfile"

# Delete the resources.
#
Expand Down
Loading