[GitHub] flink pull request #6074: [FLINK-9429] [test] Fix does not properly terminat...

2018-05-24 Thread tzulitai
Github user tzulitai commented on a diff in the pull request:

https://github.com/apache/flink/pull/6074#discussion_r190786548
  
--- Diff: flink-end-to-end-tests/test-scripts/elasticsearch-common.sh ---
@@ -61,8 +61,9 @@ function verify_result {
 rm $TEST_DATA_DIR/output
 fi
 
-while : ; do
-  curl 'localhost:9200/index/_search?q=*&pretty&size=21' > 
$TEST_DATA_DIR/output
+# make sure can terminate properly with control-C.
+while [ $? -ne 130 ]; do
--- End diff --

I would prefer that we just wrap the Elasticsearch querying to another 
function, that improves readability.

Something along the lines of:
```
function fetch_elasticsearch {
curl 'localhost:9200/index3/_count?q=*&pretty' > $TEST_DATA_DIR/output
echo $(grep '\"count\"' $TEST_DATA_DIR/output | awk '{print $3}' | sed 
's/\(.*\),/\1 /')
}

function verify_result {
local numRecords=$1

if [ -f "$TEST_DATA_DIR/output" ]; then
rm $TEST_DATA_DIR/output
fi

while (( $(fetch_elasticsearch) < $numRecords )) ; do
  echo "Waiting for Elasticsearch records ..."
  sleep 1
done
}
```


---


[GitHub] flink pull request #6074: [FLINK-9429] [test] Fix does not properly terminat...

2018-05-24 Thread zhangminglei
GitHub user zhangminglei opened a pull request:

https://github.com/apache/flink/pull/6074

[FLINK-9429] [test] Fix does not properly terminate with control-C

## What is the purpose of the change

Fix the test does not terminate with control-C.

## Verifying this change

This change is a trivial rework / code cleanup without any test coverage.


You can merge this pull request into a Git repository by running:

$ git pull https://github.com/zhangminglei/flink flink-9429

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/flink/pull/6074.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #6074


commit 7a7e275f15622e54946e53667a58233d21187d11
Author: zhangminglei 
Date:   2018-05-25T03:19:52Z

[FLINK-9429] [test] Fix does not properly terminate with control-C




---