You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flink.apache.org by tz...@apache.org on 2018/10/10 09:04:00 UTC

[flink] branch release-1.6 updated: [FLINK-10361] Harden instable elastic search end-to-end test case

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

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


The following commit(s) were added to refs/heads/release-1.6 by this push:
     new da03a2c  [FLINK-10361] Harden instable elastic search end-to-end test case
da03a2c is described below

commit da03a2c49ecb60dc5d52a28ae0e59ccbc9247573
Author: ifndef-SleePy <mm...@gmail.com>
AuthorDate: Tue Oct 9 17:35:52 2018 +0800

    [FLINK-10361] Harden instable elastic search end-to-end test case
    
    This closes #6789.
---
 .../test-scripts/elasticsearch-common.sh                 | 16 ++++++++--------
 flink-end-to-end-tests/test-scripts/test_quickstarts.sh  |  2 +-
 .../test-scripts/test_streaming_elasticsearch.sh         |  2 +-
 3 files changed, 10 insertions(+), 10 deletions(-)

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 fa6c331..45d2259 100644
--- a/flink-end-to-end-tests/test-scripts/elasticsearch-common.sh
+++ b/flink-end-to-end-tests/test-scripts/elasticsearch-common.sh
@@ -41,22 +41,22 @@ function setup_elasticsearch {
     $elasticsearchDir/bin/elasticsearch &
 }
 
-function verify_elasticsearch_process_exist {
-    for ((i=1;i<=10;i++)); do
-        local elasticsearchProcess=$(jps | grep Elasticsearch | awk '{print $2}')
+function wait_elasticsearch_working {
+    echo "Waiting for Elasticsearch node to work..."
 
-        echo "Waiting for Elasticsearch node to start ..."
+    for ((i=1;i<=60;i++)); do
+        curl -XGET 'http://localhost:9200'
 
-        # make sure the elasticsearch node is actually running
-        if [ "$elasticsearchProcess" != "Elasticsearch" ]; then
+        # make sure the elasticsearch node is actually working
+        if [ $? -ne 0 ]; then
             sleep 1
         else
-            echo "Elasticsearch node is running."
+            echo "Elasticsearch node is working."
             return
         fi
     done
 
-    echo "Elasticsearch node did not start properly"
+    echo "Elasticsearch node is not working"
     exit 1
 }
 
diff --git a/flink-end-to-end-tests/test-scripts/test_quickstarts.sh b/flink-end-to-end-tests/test-scripts/test_quickstarts.sh
index 21bdfb3..361d609 100755
--- a/flink-end-to-end-tests/test-scripts/test_quickstarts.sh
+++ b/flink-end-to-end-tests/test-scripts/test_quickstarts.sh
@@ -95,7 +95,7 @@ else
 fi
 
 setup_elasticsearch "https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-5.1.2.tar.gz"
-verify_elasticsearch_process_exist
+wait_elasticsearch_working
 
 function shutdownAndCleanup {
     # don't call ourselves again for another signal interruption
diff --git a/flink-end-to-end-tests/test-scripts/test_streaming_elasticsearch.sh b/flink-end-to-end-tests/test-scripts/test_streaming_elasticsearch.sh
index 800c4e2..deea988 100755
--- a/flink-end-to-end-tests/test-scripts/test_streaming_elasticsearch.sh
+++ b/flink-end-to-end-tests/test-scripts/test_streaming_elasticsearch.sh
@@ -26,7 +26,7 @@ DOWNLOAD_URL=$2
 mkdir -p $TEST_DATA_DIR
 
 setup_elasticsearch $DOWNLOAD_URL
-verify_elasticsearch_process_exist
+wait_elasticsearch_working
 
 start_cluster