mirror of
https://github.com/YunoHost/package_check.git
synced 2024-09-03 20:06:20 +02:00
curl tests: better debugging UX for 50x errors
This commit is contained in:
parent
ab4472e734
commit
150c1e1f11
2 changed files with 10 additions and 3 deletions
|
@ -189,7 +189,8 @@ def test(
|
|||
)
|
||||
|
||||
assets = []
|
||||
if auto_test_assets:
|
||||
# Auto-check assets - though skip this if we ended up with a 502 to prevent displaying warnings etc.
|
||||
if auto_test_assets and not str(code).startswith("5"):
|
||||
assets_to_check = []
|
||||
stylesheets = html.find_all("link", rel="stylesheet", href=True)
|
||||
stylesheets = [
|
||||
|
|
10
lib/tests.sh
10
lib/tests.sh
|
@ -272,7 +272,7 @@ _VALIDATE_THAT_APP_CAN_BE_ACCESSED () {
|
|||
|
||||
curl_result=${PIPESTATUS[0]}
|
||||
|
||||
# If we had a 50x error, try to display service info and logs to help debugging
|
||||
# If we had a 50x error, try to display service info and logs to help debugging (but we don't display nginx logs because most of the time the issue ain't in nginx)
|
||||
if [[ $curl_result == 5 ]]
|
||||
then
|
||||
LXC_EXEC "systemctl --no-pager --all" | grep "$app_id_to_check.*service"
|
||||
|
@ -280,7 +280,13 @@ _VALIDATE_THAT_APP_CAN_BE_ACCESSED () {
|
|||
do
|
||||
LXC_EXEC "journalctl --no-pager --no-hostname -n 30 -u $SERVICE";
|
||||
done
|
||||
LXC_EXEC "tail -v -n 15 \$(find /var/log/{nginx/,php*,$app_id_to_check} -mmin -3)"
|
||||
LXC_EXEC "tail -v -n 15 \$(find /var/log/{php*,$app_id_to_check} -mmin -3 2>/dev/null)"
|
||||
fi
|
||||
# Display nginx logs only if for non-50x errors (sor for example 404) to avoid poluting the debug log
|
||||
if [[ $curl_result != 5 ]] && [[ $curl_result != 0 ]]
|
||||
then
|
||||
LXC_EXEC "tail -v -n 15 \$(find /var/log/nginx/ -mmin -3)"
|
||||
|
||||
fi
|
||||
|
||||
return $curl_result
|
||||
|
|
Loading…
Add table
Reference in a new issue