flink git commit: [FLINK-9163] [e2e-tests] harden signal traps and config restoration
Repository: flink Updated Branches: refs/heads/release-1.5 688630c64 -> f97c0c15e [FLINK-9163] [e2e-tests] harden signal traps and config restoration This closes #5841. Project: http://git-wip-us.apache.org/repos/asf/flink/repo Commit: http://git-wip-us.apache.org/repos/asf/flink/commit/f97c0c15 Tree: http://git-wip-us.apache.org/repos/asf/flink/tree/f97c0c15 Diff: http://git-wip-us.apache.org/repos/asf/flink/diff/f97c0c15 Branch: refs/heads/release-1.5 Commit: f97c0c15ebb6908bcb4bebbeb180c24f883147b2 Parents: 688630c Author: Nico Kruber Authored: Fri Apr 6 12:36:41 2018 +0200 Committer: Tzu-Li (Gordon) Tai Committed: Mon Apr 16 14:34:14 2018 +0800 -- flink-end-to-end-tests/test-scripts/common.sh | 21 .../test-scripts/test_resume_savepoint.sh | 8 ++-- .../test-scripts/test_streaming_kafka010.sh | 8 ++-- .../test-scripts/test_streaming_sql.sh | 4 4 files changed, 29 insertions(+), 12 deletions(-) -- http://git-wip-us.apache.org/repos/asf/flink/blob/f97c0c15/flink-end-to-end-tests/test-scripts/common.sh -- diff --git a/flink-end-to-end-tests/test-scripts/common.sh b/flink-end-to-end-tests/test-scripts/common.sh index 0db735a..fd592ff 100644 --- a/flink-end-to-end-tests/test-scripts/common.sh +++ b/flink-end-to-end-tests/test-scripts/common.sh @@ -43,14 +43,12 @@ function revert_default_config() { # revert our modifications to the masters file if [ -f $FLINK_DIR/conf/masters.bak ]; then -rm $FLINK_DIR/conf/masters -mv $FLINK_DIR/conf/masters.bak $FLINK_DIR/conf/masters +mv -f $FLINK_DIR/conf/masters.bak $FLINK_DIR/conf/masters fi # revert our modifications to the Flink conf yaml if [ -f $FLINK_DIR/conf/flink-conf.yaml.bak ]; then -rm $FLINK_DIR/conf/flink-conf.yaml -mv $FLINK_DIR/conf/flink-conf.yaml.bak $FLINK_DIR/conf/flink-conf.yaml +mv -f $FLINK_DIR/conf/flink-conf.yaml.bak $FLINK_DIR/conf/flink-conf.yaml fi } @@ -158,7 +156,7 @@ function stop_cluster { "$FLINK_DIR"/bin/stop-cluster.sh # stop zookeeper only if there are processes running - if ! [ `jps | grep 'FlinkZooKeeperQuorumPeer' | wc -l` -eq 0 ]; then + if ! [ "`jps | grep 'FlinkZooKeeperQuorumPeer' | wc -l`" = "0" ]; then "$FLINK_DIR"/bin/zookeeper.sh stop fi @@ -236,8 +234,15 @@ function check_result_hash { local outfile_prefix=$2 local expected=$3 - local actual=$(LC_ALL=C sort $outfile_prefix* | md5sum | awk '{print $1}' \ -|| LC_ALL=C sort $outfile_prefix* | md5 -q) || exit 2 # OSX + local actual + if [ "`command -v md5`" != "" ]; then +actual=$(LC_ALL=C sort $outfile_prefix* | md5 -q) + elif [ "`command -v md5sum`" != "" ]; then +actual=$(LC_ALL=C sort $outfile_prefix* | md5sum | awk '{print $1}') + else +echo "Neither 'md5' nor 'md5sum' binary available." +exit 2 + fi if [[ "$actual" != "$expected" ]] then echo "FAIL $name: Output hash mismatch. Got $actual, expected $expected." @@ -301,7 +306,7 @@ function cleanup { stop_cluster check_all_pass rm -rf $TEST_DATA_DIR - rm $FLINK_DIR/log/* + rm -f $FLINK_DIR/log/* revert_default_config } trap cleanup EXIT http://git-wip-us.apache.org/repos/asf/flink/blob/f97c0c15/flink-end-to-end-tests/test-scripts/test_resume_savepoint.sh -- diff --git a/flink-end-to-end-tests/test-scripts/test_resume_savepoint.sh b/flink-end-to-end-tests/test-scripts/test_resume_savepoint.sh index 6642ad5..621eac1 100755 --- a/flink-end-to-end-tests/test-scripts/test_resume_savepoint.sh +++ b/flink-end-to-end-tests/test-scripts/test_resume_savepoint.sh @@ -50,11 +50,15 @@ start_cluster # make sure to stop Kafka and ZooKeeper at the end, as well as cleaning up the Flink cluster and our moodifications function test_cleanup { + # don't call ourselves again for another signal interruption + trap "exit -1" INT + # don't call ourselves again for normal exit + trap "" EXIT + stop_kafka_cluster # revert our modifications to the Flink distribution - rm $FLINK_DIR/conf/flink-conf.yaml - mv $FLINK_DIR/conf/flink-conf.yaml.bak $FLINK_DIR/conf/flink-conf.yaml + mv -f $FLINK_DIR/conf/flink-conf.yaml.bak $FLINK_DIR/conf/flink-conf.yaml rm $FLINK_DIR/lib/flink-metrics-slf4j-*.jar # make sure to run regular cleanup as well http://git-wip-us.apache.org/repos/asf/flink/blob/f97c0c15/flink-end-to-end-tests/test-scripts/test_streaming_kafka010.sh -- diff --git a/flink-end-to-end-tests/test-scripts/test_streaming_kafka010.sh b/flink-end-to-end-tests/test-scripts/test_streaming_kafka010.sh index 0c318b6..4d7525f 100755 --- a/flink-end-to-end-
flink git commit: [FLINK-9163] [e2e-tests] harden signal traps and config restoration
Repository: flink Updated Branches: refs/heads/master ffb03821f -> 71c3cd278 [FLINK-9163] [e2e-tests] harden signal traps and config restoration This closes #5841. Project: http://git-wip-us.apache.org/repos/asf/flink/repo Commit: http://git-wip-us.apache.org/repos/asf/flink/commit/71c3cd27 Tree: http://git-wip-us.apache.org/repos/asf/flink/tree/71c3cd27 Diff: http://git-wip-us.apache.org/repos/asf/flink/diff/71c3cd27 Branch: refs/heads/master Commit: 71c3cd2781d36e0a03d022a38cc4503d343f7ff8 Parents: ffb0382 Author: Nico Kruber Authored: Fri Apr 6 12:36:41 2018 +0200 Committer: Tzu-Li (Gordon) Tai Committed: Mon Apr 16 13:32:21 2018 +0800 -- flink-end-to-end-tests/test-scripts/common.sh | 21 .../test-scripts/test_resume_savepoint.sh | 8 ++-- .../test-scripts/test_streaming_kafka010.sh | 8 ++-- .../test-scripts/test_streaming_sql.sh | 4 4 files changed, 29 insertions(+), 12 deletions(-) -- http://git-wip-us.apache.org/repos/asf/flink/blob/71c3cd27/flink-end-to-end-tests/test-scripts/common.sh -- diff --git a/flink-end-to-end-tests/test-scripts/common.sh b/flink-end-to-end-tests/test-scripts/common.sh index 0db735a..fd592ff 100644 --- a/flink-end-to-end-tests/test-scripts/common.sh +++ b/flink-end-to-end-tests/test-scripts/common.sh @@ -43,14 +43,12 @@ function revert_default_config() { # revert our modifications to the masters file if [ -f $FLINK_DIR/conf/masters.bak ]; then -rm $FLINK_DIR/conf/masters -mv $FLINK_DIR/conf/masters.bak $FLINK_DIR/conf/masters +mv -f $FLINK_DIR/conf/masters.bak $FLINK_DIR/conf/masters fi # revert our modifications to the Flink conf yaml if [ -f $FLINK_DIR/conf/flink-conf.yaml.bak ]; then -rm $FLINK_DIR/conf/flink-conf.yaml -mv $FLINK_DIR/conf/flink-conf.yaml.bak $FLINK_DIR/conf/flink-conf.yaml +mv -f $FLINK_DIR/conf/flink-conf.yaml.bak $FLINK_DIR/conf/flink-conf.yaml fi } @@ -158,7 +156,7 @@ function stop_cluster { "$FLINK_DIR"/bin/stop-cluster.sh # stop zookeeper only if there are processes running - if ! [ `jps | grep 'FlinkZooKeeperQuorumPeer' | wc -l` -eq 0 ]; then + if ! [ "`jps | grep 'FlinkZooKeeperQuorumPeer' | wc -l`" = "0" ]; then "$FLINK_DIR"/bin/zookeeper.sh stop fi @@ -236,8 +234,15 @@ function check_result_hash { local outfile_prefix=$2 local expected=$3 - local actual=$(LC_ALL=C sort $outfile_prefix* | md5sum | awk '{print $1}' \ -|| LC_ALL=C sort $outfile_prefix* | md5 -q) || exit 2 # OSX + local actual + if [ "`command -v md5`" != "" ]; then +actual=$(LC_ALL=C sort $outfile_prefix* | md5 -q) + elif [ "`command -v md5sum`" != "" ]; then +actual=$(LC_ALL=C sort $outfile_prefix* | md5sum | awk '{print $1}') + else +echo "Neither 'md5' nor 'md5sum' binary available." +exit 2 + fi if [[ "$actual" != "$expected" ]] then echo "FAIL $name: Output hash mismatch. Got $actual, expected $expected." @@ -301,7 +306,7 @@ function cleanup { stop_cluster check_all_pass rm -rf $TEST_DATA_DIR - rm $FLINK_DIR/log/* + rm -f $FLINK_DIR/log/* revert_default_config } trap cleanup EXIT http://git-wip-us.apache.org/repos/asf/flink/blob/71c3cd27/flink-end-to-end-tests/test-scripts/test_resume_savepoint.sh -- diff --git a/flink-end-to-end-tests/test-scripts/test_resume_savepoint.sh b/flink-end-to-end-tests/test-scripts/test_resume_savepoint.sh index 6642ad5..621eac1 100755 --- a/flink-end-to-end-tests/test-scripts/test_resume_savepoint.sh +++ b/flink-end-to-end-tests/test-scripts/test_resume_savepoint.sh @@ -50,11 +50,15 @@ start_cluster # make sure to stop Kafka and ZooKeeper at the end, as well as cleaning up the Flink cluster and our moodifications function test_cleanup { + # don't call ourselves again for another signal interruption + trap "exit -1" INT + # don't call ourselves again for normal exit + trap "" EXIT + stop_kafka_cluster # revert our modifications to the Flink distribution - rm $FLINK_DIR/conf/flink-conf.yaml - mv $FLINK_DIR/conf/flink-conf.yaml.bak $FLINK_DIR/conf/flink-conf.yaml + mv -f $FLINK_DIR/conf/flink-conf.yaml.bak $FLINK_DIR/conf/flink-conf.yaml rm $FLINK_DIR/lib/flink-metrics-slf4j-*.jar # make sure to run regular cleanup as well http://git-wip-us.apache.org/repos/asf/flink/blob/71c3cd27/flink-end-to-end-tests/test-scripts/test_streaming_kafka010.sh -- diff --git a/flink-end-to-end-tests/test-scripts/test_streaming_kafka010.sh b/flink-end-to-end-tests/test-scripts/test_streaming_kafka010.sh index 0c318b6..4d7525f 100755 --- a/flink-end-to-end-tests/test