diff --git a/tests/lib/rest.sh b/tests/lib/rest.sh index 0e16e93b..b4d3eed6 100644 --- a/tests/lib/rest.sh +++ b/tests/lib/rest.sh @@ -106,11 +106,15 @@ rest_urlencoded() { fi fi if [ $REST_HTTP_CODE -lt 200 -o $REST_HTTP_CODE -ge 300 ]; then - REST_ERROR="REST status $REST_HTTP_CODE: $REST_OUTPUT" + if [ -z "$REST_OUTPUT" ]; then + REST_ERROR="Server returned status $REST_HTTP_CODE" + else + REST_ERROR="Server returned status $REST_HTTP_CODE: $REST_OUTPUT" + fi echo "${F_DANGER}$REST_ERROR${F_RESET}" 1>&2 if $is_local && [ $REST_HTTP_CODE -ge 500 ]; then echo -n "$F_WARN" - tail -100 /var/log/syslog + tail -100 /var/log/syslog | grep -i "(traceback|err|warn|fail|fatal|uncaught)" 1>&2 echo -n "$F_RESET" fi return 2 diff --git a/tests/suites/_mail-functions.sh b/tests/suites/_mail-functions.sh index 85336e95..e351e67b 100644 --- a/tests/suites/_mail-functions.sh +++ b/tests/suites/_mail-functions.sh @@ -96,24 +96,24 @@ start_mail_capture() { dump_capture_logs() { # dump log files record "[capture log dump]" - echo "" - echo "============= SYSLOG ================" + record "" + record "============= SYSLOG ================" tail --lines=+$SYS_LOG_LINECOUNT /var/log/syslog 2>>$TEST_OF - echo "" - echo "============= SLAPD =================" + record "" + record "============= SLAPD =================" tail --lines=+$SLAPD_LOG_LINECOUNT /var/log/ldap/slapd.log 2>>$TEST_OF - echo "" - echo "============= MAIL.ERR ==============" + record "" + record "============= MAIL.ERR ==============" tail --lines=+$MAIL_ERRLOG_LINECOUNT /var/log/mail.err 2>>$TEST_OF - echo "" - echo "============= MAIL.LOG ==============" + record "" + record "============= MAIL.LOG ==============" tail --lines=+$MAIL_LOG_LINECOUNT /var/log/mail.log 2>>$TEST_OF - echo "" - echo "============= DOVECOT ERRORS ==============" + record "" + record "============= DOVECOT ERRORS ==============" doveadm log errors | tail --lines=+$DOVECOT_LOG_LINECOUNT 2>>$TEST_OF - echo "" - echo "============= Z-PUSH LOG ==============" - tail --lines=+$ZPUSH_LOG_LINECOUND /var/log/z-push/z-push.log 2>>TEST_OF + record "" + record "============= Z-PUSH LOG ==============" + tail --lines=+$ZPUSH_LOG_LINECOUND /var/log/z-push/z-push.log 2>>$TEST_OF } detect_syslog_error() { diff --git a/tests/suites/z-push.sh b/tests/suites/z-push.sh index 2ae00023..8c9057b0 100644 --- a/tests/suites/z-push.sh +++ b/tests/suites/z-push.sh @@ -16,7 +16,7 @@ test_zpush_logon() { start_log_capture rest_urlencoded POST "/Microsoft-Server-ActiveSync?Cmd=Ping&DeviceId=$devid&DeviceType=$devtype" "$alice" "$alice_pw" 2>>$TEST_OF if [ $? -ne 0 ]; then - test_failure "$REST_ERROR" + test_failure "Error in REST call to z-push: $REST_ERROR" fi record "$REST_OUTPUT" @@ -49,7 +49,7 @@ test_zpush_logon() { local count let count="$ZPUSH_LOG_LINECOUNT + 1" local matches - matches=( $(tail --lines=+$count /var/log/z-push/z-push.log 2>>$TEST_OF | grep -F -- "->Logon(" 2>>$TEST_OF | sed -E "s/^.* (.*)->Logon\\(.*$/\\1/" 2>>%TEST_OF | sort | uniq) ) + matches=( $(tail --lines=+$count /var/log/z-push/z-push.log 2>>$TEST_OF | grep -F -- "->Logon(" 2>>$TEST_OF | sed -E "s/^.* (.*)->Logon\\(.*$/\\1/" 2>>$TEST_OF | sort | uniq) ) record "found successful logons for backends: ${matches[*]}" if [ "${matches[*]}" != "$expected_backends" ] then