Skip to content

Commit

Permalink
[FLINK-10361] Harden instable elastic search end-to-end test case
Browse files Browse the repository at this point in the history
This closes apache#6789.
  • Loading branch information
ifndef-SleePy authored and tzulitai committed Oct 10, 2018
1 parent 2f9d955 commit f071cd5
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
16 changes: 8 additions & 8 deletions flink-end-to-end-tests/test-scripts/elasticsearch-common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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:https://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
}

Expand Down
2 changes: 1 addition & 1 deletion flink-end-to-end-tests/test-scripts/test_quickstarts.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion flink-end-to-end-tests/test-scripts/test_sql_client.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit f071cd5

Please sign in to comment.