hailin0 commented on code in PR #3711:
URL: 
https://github.com/apache/incubator-seatunnel/pull/3711#discussion_r1046584354


##########
seatunnel-e2e/seatunnel-connector-v2-e2e/connector-kafka-e2e/src/test/java/org/apache/seatunnel/e2e/connector/kafka/KafkaIT.java:
##########
@@ -148,6 +152,32 @@ public void testSinkKafka(TestContainer container) throws 
IOException, Interrupt
         Assertions.assertEquals(10, data.size());
     }
 
+    @TestTemplate
+    public void testTextFormatSinkKafka(TestContainer container) throws 
IOException, InterruptedException {
+        Container.ExecResult execResult = 
container.executeJob("/kafkaTextsink_fake_to_kafka.conf");
+        Assertions.assertEquals(0, execResult.getExitCode(), 
execResult.getStderr());
+
+        String topicName = "test_text_topic";
+        Map<String, String> data = new HashMap<>();
+        try (KafkaConsumer<String, String> consumer = new 
KafkaConsumer<>(kafkaConsumerConfig())) {
+            consumer.subscribe(Arrays.asList(topicName));
+            Map<TopicPartition, Long> offsets = 
consumer.endOffsets(Arrays.asList(new TopicPartition(topicName, 0)));
+            Long endOffset = offsets.entrySet().iterator().next().getValue();
+            Long lastProcessedOffset = -1L;
+
+            do {
+                ConsumerRecords<String, String> records = 
consumer.poll(Duration.ofMillis(100));
+                for (ConsumerRecord<String, String> record : records) {
+                    if (lastProcessedOffset < record.offset()) {
+                        data.put(record.key(), record.value());
+                    }
+                    lastProcessedOffset = record.offset();
+                }
+            } while (lastProcessedOffset < endOffset - 1);
+        }
+        Assertions.assertEquals(10, data.size());

Review Comment:
   check data content & format



-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to