You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flink.apache.org by pn...@apache.org on 2018/11/09 08:53:24 UTC
[flink] branch release-1.7 updated: [FLINK-10801][e2e] Retry
verify_result_hash in elastichsearch-common (#7060)
This is an automated email from the ASF dual-hosted git repository.
pnowojski pushed a commit to branch release-1.7
in repository https://gitbox.apache.org/repos/asf/flink.git
The following commit(s) were added to refs/heads/release-1.7 by this push:
new 158e2c8 [FLINK-10801][e2e] Retry verify_result_hash in elastichsearch-common (#7060)
158e2c8 is described below
commit 158e2c89e15eeed1dad1404b66709c5854d2049f
Author: Piotr Nowojski <pn...@users.noreply.github.com>
AuthorDate: Fri Nov 9 09:52:15 2018 +0100
[FLINK-10801][e2e] Retry verify_result_hash in elastichsearch-common (#7060)
Instead of looping the verification until the expected number of results
loop until we get the correct output. This tries to solve the problem
of some records (aggregated? updated?) arriving later.
---
flink-end-to-end-tests/test-scripts/common.sh | 15 +++++++++--
.../test-scripts/elasticsearch-common.sh | 31 +++++++++++++++-------
2 files changed, 34 insertions(+), 12 deletions(-)
diff --git a/flink-end-to-end-tests/test-scripts/common.sh b/flink-end-to-end-tests/test-scripts/common.sh
index 5d45554..41dfe0f 100644
--- a/flink-end-to-end-tests/test-scripts/common.sh
+++ b/flink-end-to-end-tests/test-scripts/common.sh
@@ -451,6 +451,16 @@ function cancel_job {
}
function check_result_hash {
+ local error_code=0
+ check_result_hash_no_exit "$@" || error_code=$?
+
+ if [ "$error_code" != "0" ]
+ then
+ exit $error_code
+ fi
+}
+
+function check_result_hash_no_exit {
local name=$1
local outfile_prefix=$2
local expected=$3
@@ -462,18 +472,19 @@ function check_result_hash {
actual=$(LC_ALL=C sort $outfile_prefix* | md5sum | awk '{print $1}')
else
echo "Neither 'md5' nor 'md5sum' binary available."
- exit 2
+ return 2
fi
if [[ "$actual" != "$expected" ]]
then
echo "FAIL $name: Output hash mismatch. Got $actual, expected $expected."
echo "head hexdump of actual:"
head $outfile_prefix* | hexdump -c
- exit 1
+ return 1
else
echo "pass $name"
# Output files are left behind in /tmp
fi
+ return 0
}
# This function starts the given number of task managers and monitors their processes.
diff --git a/flink-end-to-end-tests/test-scripts/elasticsearch-common.sh b/flink-end-to-end-tests/test-scripts/elasticsearch-common.sh
index 8bb9c42..6959052 100644
--- a/flink-end-to-end-tests/test-scripts/elasticsearch-common.sh
+++ b/flink-end-to-end-tests/test-scripts/elasticsearch-common.sh
@@ -83,23 +83,34 @@ function verify_result_hash {
local name=$1
local index=$2
local numRecords=$3
- local hash=$4
+ local expectedHash=$4
- while : ; do
+ for i in {1..30}
+ do
+ local error_code=0
+
+ echo "Result verification attempt $i..."
curl "localhost:9200/${index}/_search?q=*&pretty" > $TEST_DATA_DIR/es_output || true
- if [ -n "$(grep "\"total\" : $numRecords" $TEST_DATA_DIR/es_output)" ]; then
- break
- else
- echo "Waiting for Elasticsearch records ..."
+ # remove meta information
+ sed '2,9d' $TEST_DATA_DIR/es_output > $TEST_DATA_DIR/es_content
+
+ check_result_hash_no_exit "$name" $TEST_DATA_DIR/es_content "$expectedHash" || error_code=$?
+
+ if [ "$error_code" != "0" ]
+ then
+ echo "Result verification attempt $i has failed"
sleep 1
+ else
+ break
fi
done
- # remove meta information
- sed '2,9d' $TEST_DATA_DIR/es_output > $TEST_DATA_DIR/es_content
-
- check_result_hash "$name" $TEST_DATA_DIR/es_content "$hash"
+ if [ "$error_code" != "0" ]
+ then
+ echo "All result verification attempts have failed"
+ exit $error_code
+ fi
}
function shutdown_elasticsearch_cluster {