You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flink.apache.org by dw...@apache.org on 2018/11/01 10:56:45 UTC

[flink] 02/02: [FLINK-10669][e2e] Fixed error & exception checking in logs

This is an automated email from the ASF dual-hosted git repository.

dwysakowicz pushed a commit to branch release-1.5
in repository https://gitbox.apache.org/repos/asf/flink.git

commit f4cc962ceffe50c06802dd7348c2e724999917d4
Author: Dawid Wysakowicz <dw...@apache.org>
AuthorDate: Tue Oct 23 17:09:14 2018 +0200

    [FLINK-10669][e2e] Fixed error & exception checking in logs
    
    Previously the 'q' flag of grep make the last element of pipeline exit
    as soon as the condition was satisfied. This resulted that if there were
    multiple log files and the condition was met for the first file,
    operations on subsequent files tried to write to closed pipe which
    resulted in pipefail code and the if condition to be evaluated
    incorrectly.
---
 flink-end-to-end-tests/test-scripts/common.sh | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/flink-end-to-end-tests/test-scripts/common.sh b/flink-end-to-end-tests/test-scripts/common.sh
index c4a0858..32d186b 100644
--- a/flink-end-to-end-tests/test-scripts/common.sh
+++ b/flink-end-to-end-tests/test-scripts/common.sh
@@ -215,7 +215,7 @@ function start_cluster {
 }
 
 function check_logs_for_errors {
-  if grep -rv "GroupCoordinatorNotAvailableException" $FLINK_DIR/log \
+  error_count=$(grep -rv "GroupCoordinatorNotAvailableException" $FLINK_DIR/log \
       | grep -v "RetriableCommitFailedException" \
       | grep -v "NoAvailableBrokersException" \
       | grep -v "Async Kafka commit failed" \
@@ -229,7 +229,8 @@ function check_logs_for_errors {
       | grep -v "An exception was thrown by an exception handler" \
       | grep -v "java.lang.NoClassDefFoundError: org/apache/hadoop/yarn/exceptions/YarnException" \
       | grep -v "java.lang.NoClassDefFoundError: org/apache/hadoop/conf/Configuration" \
-      | grep -iq "error"; then
+      | grep -ic "error")
+  if [[ ${error_count} -gt 0 ]]; then
     echo "Found error in log files:"
     cat $FLINK_DIR/log/*
     EXIT_CODE=1
@@ -237,7 +238,7 @@ function check_logs_for_errors {
 }
 
 function check_logs_for_exceptions {
-  if grep -rv "GroupCoordinatorNotAvailableException" $FLINK_DIR/log \
+  exception_count=$(grep -rv "GroupCoordinatorNotAvailableException" $FLINK_DIR/log \
       | grep -v "RetriableCommitFailedException" \
       | grep -v "NoAvailableBrokersException" \
       | grep -v "Async Kafka commit failed" \
@@ -252,7 +253,8 @@ function check_logs_for_exceptions {
       | grep -v "Caused by: java.lang.ClassNotFoundException: org.apache.hadoop.conf.Configuration" \
       | grep -v "java.lang.NoClassDefFoundError: org/apache/hadoop/yarn/exceptions/YarnException" \
       | grep -v "java.lang.NoClassDefFoundError: org/apache/hadoop/conf/Configuration" \
-      | grep -iq "exception"; then
+      | grep -ic "exception")
+  if [[ ${exception_count} -gt 0 ]]; then
     echo "Found exception in log files:"
     cat $FLINK_DIR/log/*
     EXIT_CODE=1