harveyyue commented on code in PR #3230:
URL: 
https://github.com/apache/incubator-seatunnel/pull/3230#discussion_r1013656362


##########
seatunnel-e2e/seatunnel-connector-v2-e2e/connector-kafka-e2e/src/test/java/org/apache/seatunnel/e2e/connector/kafka/KafkaIT.java:
##########
@@ -84,51 +83,55 @@ public void startKafkaContainer() {
                 .pollInterval(500, TimeUnit.MILLISECONDS)
                 .atMost(180, TimeUnit.SECONDS)
                 .untilAsserted(() -> initKafkaProducer());
-        generateTestData();
     }
 
-    @SuppressWarnings("checkstyle:Indentation")
-    private void generateTestData() {
-
-        SeaTunnelRowType seatunnelRowType = new SeaTunnelRowType(
-                new String[]{
-                        "id",
-                        "c_map",
-                        "c_array",
-                        "c_string",
-                        "c_boolean",
-                        "c_tinyint",
-                        "c_smallint",
-                        "c_int",
-                        "c_bigint",
-                        "c_float",
-                        "c_double",
-                        "c_decimal",
-                        "c_bytes",
-                        "c_date",
-                        "c_timestamp"
-                },
-                new SeaTunnelDataType[]{
-                        BasicType.LONG_TYPE,
-                        new MapType(BasicType.STRING_TYPE, 
BasicType.SHORT_TYPE),
-                        ArrayType.BYTE_ARRAY_TYPE,
-                        BasicType.STRING_TYPE,
-                        BasicType.BOOLEAN_TYPE,
-                        BasicType.BYTE_TYPE,
-                        BasicType.SHORT_TYPE,
-                        BasicType.INT_TYPE,
-                        BasicType.LONG_TYPE,
-                        BasicType.FLOAT_TYPE,
-                        BasicType.DOUBLE_TYPE,
-                        new DecimalType(2, 1),
-                        PrimitiveByteArrayType.INSTANCE,
-                        LocalTimeType.LOCAL_DATE_TYPE,
-                        LocalTimeType.LOCAL_DATE_TIME_TYPE
-                }
-        );
-
-        DefaultSeaTunnelRowSerializer serializer = new 
DefaultSeaTunnelRowSerializer("test_topic", seatunnelRowType);
+    @AfterAll
+    @Override
+    public void tearDown() throws Exception {
+        if (producer != null) {
+            producer.close();
+        }
+        if (kafkaContainer != null) {
+            kafkaContainer.close();
+        }
+    }
+
+    @TestTemplate
+    public void testSinkKafka(TestContainer container) throws IOException, 
InterruptedException {
+        Container.ExecResult execResult = 
container.executeJob("/kafkasink_fake_to_kafka.conf");
+        Assertions.assertEquals(0, execResult.getExitCode());
+    }
+
+    @TestTemplate
+    public void testSourceKafkaTextToConsole(TestContainer container) throws 
IOException, InterruptedException {
+        TextSerializationSchema serializer = TextSerializationSchema.builder()
+                .seaTunnelRowType(SEATUNNEL_ROW_TYPE)
+                .delimiter(",")
+                .build();
+        generateTestData(row -> new ProducerRecord<>("test_topic_text", null, 
serializer.serialize(row)));
+        Container.ExecResult execResult = 
container.executeJob("/kafkasource_text_to_console.conf");
+        Assertions.assertEquals(0, execResult.getExitCode(), 
execResult.getStderr());

Review Comment:
   Already use AssertSink



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