You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by GitBox <gi...@apache.org> on 2018/10/10 09:12:23 UTC

[GitHub] asfgit closed pull request #6808: [FLINK-10361] [test] Harden instable elastic search end-to-end test case

asfgit closed pull request #6808: [FLINK-10361] [test] Harden instable elastic search end-to-end test case
URL: https://github.com/apache/flink/pull/6808
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

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 e5f1ec9ebe4..834e84528b3 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 4eeddc11503..bf005e86495 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_sql_client.sh b/flink-end-to-end-tests/test-scripts/test_sql_client.sh
index 30833fbf211..ab71f751681 100755
--- a/flink-end-to-end-tests/test-scripts/test_sql_client.sh
+++ b/flink-end-to-end-tests/test-scripts/test_sql_client.sh
@@ -109,7 +109,7 @@ ELASTICSEARCH_VERSION=6
 DOWNLOAD_URL='https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-6.3.1.tar.gz'
 
 setup_elasticsearch $DOWNLOAD_URL
-verify_elasticsearch_process_exist
+wait_elasticsearch_working
 
 ################################################################################
 # Run a SQL statement
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 36a38566707..179c5ffacc8 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
 


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services