You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flink.apache.org by al...@apache.org on 2020/09/22 08:45:39 UTC
[flink] branch release-1.11 updated: [FLINK-17159] Add sanity check
to ES6 ElasticsearchSinkITCase
This is an automated email from the ASF dual-hosted git repository.
aljoscha pushed a commit to branch release-1.11
in repository https://gitbox.apache.org/repos/asf/flink.git
The following commit(s) were added to refs/heads/release-1.11 by this push:
new 0339734 [FLINK-17159] Add sanity check to ES6 ElasticsearchSinkITCase
0339734 is described below
commit 03397343c958b5fb2c0b035d5222ce6288dc8938
Author: Aljoscha Krettek <al...@apache.org>
AuthorDate: Tue Sep 22 10:42:47 2020 +0200
[FLINK-17159] Add sanity check to ES6 ElasticsearchSinkITCase
We now try and ping the cluster in a @Before method just like the normal
ES sink would.
---
.../connectors/elasticsearch6/ElasticsearchSinkITCase.java | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/flink-connectors/flink-connector-elasticsearch6/src/test/java/org/apache/flink/streaming/connectors/elasticsearch6/ElasticsearchSinkITCase.java b/flink-connectors/flink-connector-elasticsearch6/src/test/java/org/apache/flink/streaming/connectors/elasticsearch6/ElasticsearchSinkITCase.java
index 27903df..3251a79 100644
--- a/flink-connectors/flink-connector-elasticsearch6/src/test/java/org/apache/flink/streaming/connectors/elasticsearch6/ElasticsearchSinkITCase.java
+++ b/flink-connectors/flink-connector-elasticsearch6/src/test/java/org/apache/flink/streaming/connectors/elasticsearch6/ElasticsearchSinkITCase.java
@@ -24,9 +24,13 @@ import org.apache.flink.streaming.connectors.elasticsearch.ElasticsearchSinkFunc
import org.apache.flink.streaming.connectors.elasticsearch.ElasticsearchSinkTestBase;
import org.apache.http.HttpHost;
+import org.elasticsearch.client.RestClient;
+import org.elasticsearch.client.RestClientBuilder;
import org.elasticsearch.client.RestHighLevelClient;
+import org.junit.Before;
import org.junit.Test;
+import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
@@ -35,6 +39,16 @@ import java.util.List;
*/
public class ElasticsearchSinkITCase extends ElasticsearchSinkTestBase<RestHighLevelClient, HttpHost> {
+ @Before
+ public void ensureClusterIsUp() throws IOException {
+ RestClientBuilder builder = RestClient.builder(HttpHost.create("http://127.0.0.2:9200"));
+ RestHighLevelClient client = new RestHighLevelClient(builder);
+ if (!client.ping()) {
+ throw new RuntimeException("Cannot ping cluster!");
+ }
+ System.out.println("Ping succesful.");
+ }
+
@Test
public void testElasticsearchSink() throws Exception {
runElasticsearchSinkTest();