diff --git a/lib/curl_tests.py b/lib/curl_tests.py index b9c7478..1e835ac 100644 --- a/lib/curl_tests.py +++ b/lib/curl_tests.py @@ -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 = [ diff --git a/lib/tests.sh b/lib/tests.sh index 0212696..60057c0 100644 --- a/lib/tests.sh +++ b/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