This is an automated email from the ASF dual-hosted git repository. wanghailin pushed a commit to branch dev in repository https://gitbox.apache.org/repos/asf/seatunnel.git
The following commit(s) were added to refs/heads/dev by this push: new d374e0ff31 [Improve][E2E][Doris] Add no schema test case for connector-doris-e2e (#7076) d374e0ff31 is described below commit d374e0ff319fade4fdb187bb83d3ab72187725e8 Author: bingquanzhao <bingquan_z...@icloud.com> AuthorDate: Wed Jul 3 22:18:19 2024 +0800 [Improve][E2E][Doris] Add no schema test case for connector-doris-e2e (#7076) --- .../seatunnel/e2e/connector/doris/DorisIT.java | 6 +-- .../e2e/connector/doris/DorisNoSchemaIT.java | 38 ++++++++++++++++ .../src/test/resources/doris_source_no_schema.conf | 50 ++++++++++++++++++++++ 3 files changed, 91 insertions(+), 3 deletions(-) diff --git a/seatunnel-e2e/seatunnel-connector-v2-e2e/connector-doris-e2e/src/test/java/org/apache/seatunnel/e2e/connector/doris/DorisIT.java b/seatunnel-e2e/seatunnel-connector-v2-e2e/connector-doris-e2e/src/test/java/org/apache/seatunnel/e2e/connector/doris/DorisIT.java index 7c28ebba34..03ca3ab516 100644 --- a/seatunnel-e2e/seatunnel-connector-v2-e2e/connector-doris-e2e/src/test/java/org/apache/seatunnel/e2e/connector/doris/DorisIT.java +++ b/seatunnel-e2e/seatunnel-connector-v2-e2e/connector-doris-e2e/src/test/java/org/apache/seatunnel/e2e/connector/doris/DorisIT.java @@ -224,7 +224,7 @@ public class DorisIT extends AbstractDorisIT { } } - private void checkSinkData() { + protected void checkSinkData() { try { assertHasData(sourceDB, UNIQUE_TABLE); assertHasData(sinkDB, UNIQUE_TABLE); @@ -371,7 +371,7 @@ public class DorisIT extends AbstractDorisIT { } } - private void initializeJdbcTable() { + protected void initializeJdbcTable() { try { URLClassLoader urlClassLoader = new URLClassLoader( @@ -528,7 +528,7 @@ public class DorisIT extends AbstractDorisIT { return String.format(createDuplicateTableSql, db, DUPLICATE_TABLE); } - private void batchInsertUniqueTableData() { + protected void batchInsertUniqueTableData() { List<SeaTunnelRow> rows = genUniqueTableTestData(100L); try { conn.setAutoCommit(false); diff --git a/seatunnel-e2e/seatunnel-connector-v2-e2e/connector-doris-e2e/src/test/java/org/apache/seatunnel/e2e/connector/doris/DorisNoSchemaIT.java b/seatunnel-e2e/seatunnel-connector-v2-e2e/connector-doris-e2e/src/test/java/org/apache/seatunnel/e2e/connector/doris/DorisNoSchemaIT.java new file mode 100644 index 0000000000..a2806ae9ab --- /dev/null +++ b/seatunnel-e2e/seatunnel-connector-v2-e2e/connector-doris-e2e/src/test/java/org/apache/seatunnel/e2e/connector/doris/DorisNoSchemaIT.java @@ -0,0 +1,38 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.seatunnel.e2e.connector.doris; + +import org.apache.seatunnel.e2e.common.container.TestContainer; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.TestTemplate; +import org.testcontainers.containers.Container; + +import java.io.IOException; + +public class DorisNoSchemaIT extends DorisIT { + + @TestTemplate + public void testDoris(TestContainer container) throws IOException, InterruptedException { + initializeJdbcTable(); + batchInsertUniqueTableData(); + Container.ExecResult execResult1 = container.executeJob("/doris_source_no_schema.conf"); + Assertions.assertEquals(0, execResult1.getExitCode()); + checkSinkData(); + } +} diff --git a/seatunnel-e2e/seatunnel-connector-v2-e2e/connector-doris-e2e/src/test/resources/doris_source_no_schema.conf b/seatunnel-e2e/seatunnel-connector-v2-e2e/connector-doris-e2e/src/test/resources/doris_source_no_schema.conf new file mode 100644 index 0000000000..1966d713b5 --- /dev/null +++ b/seatunnel-e2e/seatunnel-connector-v2-e2e/connector-doris-e2e/src/test/resources/doris_source_no_schema.conf @@ -0,0 +1,50 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +env{ + parallelism = 1 + job.mode = "BATCH" +} + +source{ + Doris { + fenodes = "doris_e2e:8030" + username = root + password = "" + database = "e2e_source" + table = "doris_e2e_unique_table" + doris.filter.query = "F_ID > 50" + } +} + +transform {} + +sink{ + Doris { + fenodes = "doris_e2e:8030" + schema_save_mode = "RECREATE_SCHEMA" + username = root + password = "" + table.identifier = "e2e_sink.doris_e2e_unique_table" + sink.enable-2pc = "false" + sink.label-prefix = "no_schema" + doris.config = { + format="json" + read_json_by_line="true" + } + } + } \ No newline at end of file