You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by tzulitai <gi...@git.apache.org> on 2018/05/14 06:44:32 UTC

[GitHub] flink pull request #5761: [FLINK-8989] [e2eTests] Elasticsearch1&2&5 end to ...

Github user tzulitai commented on a diff in the pull request:

    https://github.com/apache/flink/pull/5761#discussion_r187848661
  
    --- Diff: flink-end-to-end-tests/test-scripts/test_streaming_elasticsearch1.sh ---
    @@ -0,0 +1,66 @@
    +#!/usr/bin/env bash
    +################################################################################
    +# Licensed to the Apache Software Foundation (ASF) under one
    +# or more contributor license agreements.  See the NOTICE file
    +# distributed with this work for additional information
    +# regarding copyright ownership.  The ASF licenses this file
    +# to you under the Apache License, Version 2.0 (the
    +# "License"); you may not use this file except in compliance
    +# with the License.  You may obtain a copy of the License at
    +#
    +#     http://www.apache.org/licenses/LICENSE-2.0
    +#
    +# Unless required by applicable law or agreed to in writing, software
    +# distributed under the License is distributed on an "AS IS" BASIS,
    +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    +# See the License for the specific language governing permissions and
    +# limitations under the License.
    +################################################################################
    +
    +# End to end test for ElasticsearchSink1.x.
    +
    +source "$(dirname "$0")"/common.sh
    +
    +start_cluster
    +
    +mkdir -p $TEST_DATA_DIR
    +
    +ELASTICSEARCH_URL="https://download.elastic.co/elasticsearch/elasticsearch/elasticsearch-1.7.1.tar.gz"
    +echo "Downing Elasticsearch from $ELASTICSEARCH_URL"
    +curl "$ELASTICSEARCH_URL" > $TEST_DATA_DIR/elasticsearch.tar.gz
    +
    +tar xzf $TEST_DATA_DIR/elasticsearch.tar.gz -C $TEST_DATA_DIR/
    +ELASTICSEARCH_DIR=$TEST_DATA_DIR/elasticsearch-1.7.1
    +
    +# start elasticsearch cluster
    +$ELASTICSEARCH_DIR/bin/elasticsearch -daemon
    +
    +CURRENT_DIR=$(cd "$( dirname "$0"  )" && pwd )
    +
    +TEST_PROGRAM_JAR=$CURRENT_DIR/../flink-elasticsearch1-test/target/Elasticsearch1SinkExample.jar
    +
    +# run the Flink job
    +$FLINK_DIR/bin/flink run -p 1 $TEST_PROGRAM_JAR \
    +  --index index \
    +  --type type
    +
    +touch $TEST_DATA_DIR/output
    +
    +curl 'localhost:9200/index/_search?q=*&pretty&size=21' > $TEST_DATA_DIR/output
    +
    +if [ -n "$(grep '\"total\" : 21' $TEST_DATA_DIR/output)" ]; then
    +    echo "Elasticsearch end to end test pass."
    +fi
    --- End diff --
    
    we should also have the `else` case, where `PASS` is set to `""`, so that the test properly fails.


---