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 2020/07/14 02:57:22 UTC

[GitHub] [flink] wuchong commented on a change in pull request #12890: [FLINK-18583] Fix index id in ElasticSearch6 DynamicTableSink

wuchong commented on a change in pull request #12890:
URL: https://github.com/apache/flink/pull/12890#discussion_r454068637



##########
File path: flink-connectors/flink-connector-elasticsearch6/src/test/java/org/apache/flink/streaming/connectors/elasticsearch/table/Elasticsearch6DynamicSinkITCase.java
##########
@@ -226,25 +235,38 @@ public void testWritingDocumentsNoPrimaryKey() throws Exception {
 				.execute()
 				.actionGet()
 				.getHits();
-			if (hits.getTotalHits() < 1) {
+			if (hits.getTotalHits() < 2) {
 				Thread.sleep(200);
 			}
-		} while (hits.getTotalHits() < 1 && deadline.hasTimeLeft());
+		} while (hits.getTotalHits() < 2 && deadline.hasTimeLeft());
 
-		if (hits.getTotalHits() < 1) {
+		if (hits.getTotalHits() < 2) {
 			throw new AssertionError("Could not retrieve results from Elasticsearch.");
 		}
 
-		Map<String, Object> result = hits.getAt(0).getSourceAsMap();
-		Map<Object, Object> expectedMap = new HashMap<>();
-		expectedMap.put("a", 1);
-		expectedMap.put("b", "00:00:12");
-		expectedMap.put("c", "ABCDE");
-		expectedMap.put("d", 12.12d);
-		expectedMap.put("e", 2);
-		expectedMap.put("f", "2003-10-20");
-		expectedMap.put("g", "2012-12-12 12:12:12");
-		assertThat(result, equalTo(expectedMap));
+		HashSet<Map<String, Object>> resultSet = new HashSet<>();
+		resultSet.add(hits.getAt(0).getSourceAsMap());
+		resultSet.add(hits.getAt(1).getSourceAsMap());
+		Map<Object, Object> expectedMap1 = new HashMap<>();
+		expectedMap1.put("a", 1);
+		expectedMap1.put("b", "00:00:12");
+		expectedMap1.put("c", "ABCDE");
+		expectedMap1.put("d", 12.12d);
+		expectedMap1.put("e", 2);
+		expectedMap1.put("f", "2003-10-20");
+		expectedMap1.put("g", "2012-12-12 12:12:12");
+		Map<Object, Object> expectedMap2 = new HashMap<>();
+		expectedMap2.put("a", 2);
+		expectedMap2.put("b", "00:00:12");
+		expectedMap2.put("c", "FGHIJK");
+		expectedMap2.put("d", 13.13d);
+		expectedMap2.put("e", 4);
+		expectedMap2.put("f", "2003-10-20");
+		expectedMap2.put("g", "2013-12-12 13:13:13");
+		HashSet<Map<Object, Object>> expectedSet = new HashSet<>();
+		expectedSet.add(expectedMap1);
+		expectedSet.add(expectedMap2);
+		assertThat(resultSet, equalTo(expectedSet));

Review comment:
       Could you update the corresponding test in `Elasticsearch7DynamicSinkITCase`? 




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to 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