[FLINK-8596][CLI] Also catch NoClassDefFoundErrors This closes #5543.
Project: http://git-wip-us.apache.org/repos/asf/flink/repo Commit: http://git-wip-us.apache.org/repos/asf/flink/commit/f3bfd22b Tree: http://git-wip-us.apache.org/repos/asf/flink/tree/f3bfd22b Diff: http://git-wip-us.apache.org/repos/asf/flink/diff/f3bfd22b Branch: refs/heads/master Commit: f3bfd22b41acd4c16f71d6d69f7983abc63a1e71 Parents: 3e056b3 Author: zentol <[email protected]> Authored: Tue Feb 20 13:40:43 2018 +0100 Committer: zentol <[email protected]> Committed: Mon Feb 26 20:42:00 2018 +0100 ---------------------------------------------------------------------- .../apache/flink/client/cli/CliFrontend.java | 2 +- test-infra/end-to-end-test/common.sh | 3 ++ test-infra/end-to-end-test/test_hadoop_free.sh | 46 ++++++++++++++++++++ tools/travis_mvn_watchdog.sh | 10 ++++- 4 files changed, 59 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/flink/blob/f3bfd22b/flink-clients/src/main/java/org/apache/flink/client/cli/CliFrontend.java ---------------------------------------------------------------------- diff --git a/flink-clients/src/main/java/org/apache/flink/client/cli/CliFrontend.java b/flink-clients/src/main/java/org/apache/flink/client/cli/CliFrontend.java index 92d2ccb..06131dc 100644 --- a/flink-clients/src/main/java/org/apache/flink/client/cli/CliFrontend.java +++ b/flink-clients/src/main/java/org/apache/flink/client/cli/CliFrontend.java @@ -1158,7 +1158,7 @@ public class CliFrontend { configurationDirectory, "y", "yarn")); - } catch (Exception e) { + } catch (NoClassDefFoundError | Exception e) { LOG.warn("Could not load CLI class {}.", flinkYarnSessionCLI, e); } http://git-wip-us.apache.org/repos/asf/flink/blob/f3bfd22b/test-infra/end-to-end-test/common.sh ---------------------------------------------------------------------- diff --git a/test-infra/end-to-end-test/common.sh b/test-infra/end-to-end-test/common.sh index 67b7529..7492f36 100644 --- a/test-infra/end-to-end-test/common.sh +++ b/test-infra/end-to-end-test/common.sh @@ -74,6 +74,7 @@ function stop_cluster { | grep -v '^INFO:.*AWSErrorCode=\[400 Bad Request\].*ServiceEndpoint=\[https://.*\.s3\.amazonaws\.com\].*RequestType=\[HeadBucketRequest\]' \ | grep -v "RejectedExecutionException" \ | grep -v "An exception was thrown by an exception handler" \ + | grep -v "java.lang.NoClassDefFoundError: org/apache/hadoop/yarn/exceptions/YarnException" \ | grep -iq "error"; then echo "Found error in log files:" cat $FLINK_DIR/log/* @@ -90,6 +91,8 @@ function stop_cluster { | grep -v '^INFO:.*AWSErrorCode=\[400 Bad Request\].*ServiceEndpoint=\[https://.*\.s3\.amazonaws\.com\].*RequestType=\[HeadBucketRequest\]' \ | grep -v "RejectedExecutionException" \ | grep -v "An exception was thrown by an exception handler" \ + | grep -v "Caused by: java.lang.ClassNotFoundException: org.apache.hadoop.yarn.exceptions.YarnException" \ + | grep -v "java.lang.NoClassDefFoundError: org/apache/hadoop/yarn/exceptions/YarnException" \ | grep -iq "exception"; then echo "Found exception in log files:" cat $FLINK_DIR/log/* http://git-wip-us.apache.org/repos/asf/flink/blob/f3bfd22b/test-infra/end-to-end-test/test_hadoop_free.sh ---------------------------------------------------------------------- diff --git a/test-infra/end-to-end-test/test_hadoop_free.sh b/test-infra/end-to-end-test/test_hadoop_free.sh new file mode 100755 index 0000000..311357e --- /dev/null +++ b/test-infra/end-to-end-test/test_hadoop_free.sh @@ -0,0 +1,46 @@ +#!/usr/bin/env bash +################################################################################ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +################################################################################ + +source "$(dirname "$0")"/common.sh + +# move hadoop jar to /opt so it's not on the classpath +mv $FLINK_DIR/lib/flink-shaded-hadoop* $FLINK_DIR/opt +EXIT_CODE=$? +if [ $EXIT_CODE != 0 ]; then + echo "==============================================================================" + echo "Could not move hadoop jar out of /lib, aborting test." + echo "==============================================================================" +else + start_cluster + + $FLINK_DIR/bin/flink run -p 1 $FLINK_DIR/examples/batch/WordCount.jar --input $TEST_INFRA_DIR/test-data/words --output $TEST_DATA_DIR/out/wc_out + check_result_hash "WordCount" $TEST_DATA_DIR/out/wc_out "72a690412be8928ba239c2da967328a5" + EXIT_CODE=$? + + # move hadoop jar to /lib again to not have side-effects on subsequent tests + mv $FLINK_DIR/opt/flink-shaded-hadoop* $FLINK_DIR/lib + if [ $? != 0 ]; then + echo "==============================================================================" + echo "Could not move hadoop jar back to /lib, aborting tests." + echo "==============================================================================" + EXIT_CODE=1 + fi +fi + +exit $EXIT_CODE http://git-wip-us.apache.org/repos/asf/flink/blob/f3bfd22b/tools/travis_mvn_watchdog.sh ---------------------------------------------------------------------- diff --git a/tools/travis_mvn_watchdog.sh b/tools/travis_mvn_watchdog.sh index 0ef74db..4b1c2e3 100755 --- a/tools/travis_mvn_watchdog.sh +++ b/tools/travis_mvn_watchdog.sh @@ -616,7 +616,15 @@ case $TEST in EXIT_CODE=$? fi - if [ $EXIT_CODE == 0]; then + if [ $EXIT_CODE == 0 ]; then + printf "\n==============================================================================\n" + printf "Running Hadoop-free Wordcount end-to-end test\n" + printf "==============================================================================\n" + FLINK_DIR=build-target CLUSTER_MODE=cluster test-infra/end-to-end-test/test_hadoop_free.sh + EXIT_CODE=$? + fi + + if [ $EXIT_CODE == 0 ]; then printf "\n==============================================================================\n" printf "Running Streaming Python Wordcount end-to-end test\n" printf "==============================================================================\n"
