liunaijie commented on code in PR #6082:
URL: https://github.com/apache/seatunnel/pull/6082#discussion_r1442576859
##########
seatunnel-e2e/seatunnel-connector-v2-e2e/connector-kafka-e2e/src/test/java/org/apache/seatunnel/e2e/connector/kafka/KafkaIT.java:
##########
@@ -294,27 +297,150 @@ public void testSourceKafkaStartConfig(TestContainer
container)
}
@TestTemplate
- @DisabledOnContainer(TestContainerId.SPARK_2_4)
+ @DisabledOnContainer(value = {TestContainerId.SPARK_2_4})
public void testFakeSourceToKafkaAvroFormat(TestContainer container)
throws IOException, InterruptedException {
Container.ExecResult execResult =
container.executeJob("/avro/fake_source_to_kafka_avro_format.conf");
Assertions.assertEquals(0, execResult.getExitCode(),
execResult.getStderr());
+ String[] subField = {
+ "c_map",
+ "c_array",
+ "c_string",
+ "c_boolean",
+ "c_tinyint",
+ "c_smallint",
+ "c_int",
+ "c_bigint",
+ "c_float",
+ "c_double",
+ "c_bytes",
+ "c_date",
+ "c_decimal",
+ "c_timestamp"
+ };
+ SeaTunnelDataType<?>[] subFieldTypes = {
+ new MapType<>(BasicType.STRING_TYPE, BasicType.STRING_TYPE),
+ ArrayType.INT_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,
+ PrimitiveByteArrayType.INSTANCE,
+ LocalTimeType.LOCAL_DATE_TYPE,
+ new DecimalType(38, 18),
+ LocalTimeType.LOCAL_DATE_TIME_TYPE
+ };
+ SeaTunnelRowType subRow = new SeaTunnelRowType(subField,
subFieldTypes);
+ String[] fieldNames = {
+ "c_map",
+ "c_array",
+ "c_string",
+ "c_boolean",
+ "c_tinyint",
+ "c_smallint",
+ "c_int",
+ "c_bigint",
+ "c_float",
+ "c_double",
+ "c_bytes",
+ "c_date",
+ "c_decimal",
+ "c_timestamp",
+ "c_row"
+ };
+ SeaTunnelDataType<?>[] fieldTypes = {
+ new MapType<>(BasicType.STRING_TYPE, BasicType.STRING_TYPE),
+ ArrayType.INT_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,
+ PrimitiveByteArrayType.INSTANCE,
+ LocalTimeType.LOCAL_DATE_TYPE,
+ new DecimalType(38, 18),
+ LocalTimeType.LOCAL_DATE_TIME_TYPE,
+ subRow
+ };
+ SeaTunnelRowType fake_source_row_type = new
SeaTunnelRowType(fieldNames, fieldTypes);
+ AvroDeserializationSchema avroDeserializationSchema =
+ new AvroDeserializationSchema(fake_source_row_type);
+ List<SeaTunnelRow> kafkaSTRow =
+ getKafkaSTRow(
+ "test_avro_topic_fake_source",
+ value -> {
+ try {
+ return
avroDeserializationSchema.deserialize(value);
+ } catch (IOException e) {
+ throw new RuntimeException(e);
+ }
+ });
+ Assertions.assertEquals(90, kafkaSTRow.size());
+ kafkaSTRow.forEach(
+ row -> Assertions.assertEquals("fake_source_avro",
row.getField(2).toString()));
Review Comment:
This IT use fake source, if need check value here need fix the value in fake
source config.
If add fixed value config, it same with the next `testKafkaAvroToAssert`
test.
I can add some type check here. the value check will skip.
--
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]