Skip to content

Commit

Permalink
Healthcheck timeout handling (#178)
Browse files Browse the repository at this point in the history
* Feat[healthcheck]: Added timeout to curl, to avoid blocking until docker kills the process

* test[helathcheck]: Add some useful output if test fails
  • Loading branch information
sidey79 authored Apr 3, 2024
1 parent 022376b commit a2b4e43
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/health-check.sh
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ echo "$$" > $PID_FILE

while IFS= read -r fhemUrl; do
fhemwebState=$( curl \
--connect-timeout 5 \
--max-time 8 \
--silent \
--insecure \
--output /dev/null \
Expand Down
2 changes: 2 additions & 0 deletions src/tests/bats/health-check.bats
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ teardown() {
((c++)) && ((c==50)) && echo "# fhem did not start" && break
done
sleep 5
#cat $FHEM_CFG_FILE
cat ${LOG_FILE}
assert_file_contains /tmp/health-check.urls "http://localhost:8083"

run timeout 15 /health-check.sh
Expand Down

0 comments on commit a2b4e43

Please sign in to comment.