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 9a24fac2c4 [Feature][E2E] Add hive3 e2e test case (#8003)
9a24fac2c4 is described below

commit 9a24fac2c47f4a102274ef7232e4bf1e5243d058
Author: Jast <[email protected]>
AuthorDate: Mon Nov 11 20:51:34 2024 +0800

    [Feature][E2E] Add hive3 e2e test case (#8003)
---
 .github/workflows/backend.yml                      |   2 +-
 .../seatunnel/hive/storage/StorageFactory.java     |   5 +
 .../seatunnel/hive/storage/StorageType.java        |   1 +
 .../connector-hive-e2e/pom.xml                     |  26 ++++
 .../e2e/connector/hive/HiveContainer.java          | 120 +++++++++++++++
 .../seatunnel/e2e/connector/hive/HiveIT.java       | 165 ++++++++++++++++-----
 .../src/test/resources/fake_to_hive_on_hdfs.conf   |   5 +-
 .../src/test/resources/hive_on_hdfs_to_assert.conf |   4 +-
 .../e2e/common/container/TestContainer.java        |   7 +-
 .../container/seatunnel/SeaTunnelContainer.java    |   1 +
 10 files changed, 289 insertions(+), 47 deletions(-)

diff --git a/.github/workflows/backend.yml b/.github/workflows/backend.yml
index 6f51b0a9e9..89be784cae 100644
--- a/.github/workflows/backend.yml
+++ b/.github/workflows/backend.yml
@@ -818,7 +818,7 @@ jobs:
       matrix:
         java: [ '8', '11' ]
         os: [ 'ubuntu-latest' ]
-    timeout-minutes: 150
+    timeout-minutes: 180
     steps:
       - uses: actions/checkout@v2
       - name: Set up JDK ${{ matrix.java }}
diff --git 
a/seatunnel-connectors-v2/connector-hive/src/main/java/org/apache/seatunnel/connectors/seatunnel/hive/storage/StorageFactory.java
 
b/seatunnel-connectors-v2/connector-hive/src/main/java/org/apache/seatunnel/connectors/seatunnel/hive/storage/StorageFactory.java
index 8a08f2be97..926e7d70b9 100644
--- 
a/seatunnel-connectors-v2/connector-hive/src/main/java/org/apache/seatunnel/connectors/seatunnel/hive/storage/StorageFactory.java
+++ 
b/seatunnel-connectors-v2/connector-hive/src/main/java/org/apache/seatunnel/connectors/seatunnel/hive/storage/StorageFactory.java
@@ -18,6 +18,7 @@
 package org.apache.seatunnel.connectors.seatunnel.hive.storage;
 
 public class StorageFactory {
+
     public static Storage getStorageType(String hiveSdLocation) {
         if (hiveSdLocation.startsWith(StorageType.S3.name().toLowerCase())) {
             return new S3Storage();
@@ -25,6 +26,10 @@ public class StorageFactory {
             return new OSSStorage();
         } else if 
(hiveSdLocation.startsWith(StorageType.COS.name().toLowerCase())) {
             return new COSStorage();
+        } else if 
(hiveSdLocation.startsWith(StorageType.FILE.name().toLowerCase())) {
+            // Currently used in e2e, When Hive uses local files as storage, 
"file:" needs to be
+            // replaced with "file:/" to avoid being recognized as HDFS 
storage.
+            return new HDFSStorage(hiveSdLocation.replace("file:", "file:/"));
         } else {
             return new HDFSStorage(hiveSdLocation);
         }
diff --git 
a/seatunnel-connectors-v2/connector-hive/src/main/java/org/apache/seatunnel/connectors/seatunnel/hive/storage/StorageType.java
 
b/seatunnel-connectors-v2/connector-hive/src/main/java/org/apache/seatunnel/connectors/seatunnel/hive/storage/StorageType.java
index 49a7601977..b8b195a87e 100644
--- 
a/seatunnel-connectors-v2/connector-hive/src/main/java/org/apache/seatunnel/connectors/seatunnel/hive/storage/StorageType.java
+++ 
b/seatunnel-connectors-v2/connector-hive/src/main/java/org/apache/seatunnel/connectors/seatunnel/hive/storage/StorageType.java
@@ -21,5 +21,6 @@ public enum StorageType {
     S3,
     OSS,
     COS,
+    FILE,
     HDFS
 }
diff --git 
a/seatunnel-e2e/seatunnel-connector-v2-e2e/connector-hive-e2e/pom.xml 
b/seatunnel-e2e/seatunnel-connector-v2-e2e/connector-hive-e2e/pom.xml
index bd9a112b6a..aadb9e632f 100644
--- a/seatunnel-e2e/seatunnel-connector-v2-e2e/connector-hive-e2e/pom.xml
+++ b/seatunnel-e2e/seatunnel-connector-v2-e2e/connector-hive-e2e/pom.xml
@@ -25,6 +25,10 @@
     <artifactId>connector-hive-e2e</artifactId>
     <name>SeaTunnel : E2E : Connector V2 : Hive</name>
 
+    <properties>
+        <hive.version>3.1.3</hive.version>
+    </properties>
+
     <dependencies>
         <dependency>
             <groupId>org.apache.seatunnel</groupId>
@@ -44,6 +48,28 @@
             <version>${project.version}</version>
             <classifier>optional</classifier>
             <scope>test</scope>
+            <exclusions>
+                <exclusion>
+                    <groupId>log4j</groupId>
+                    <artifactId>log4j</artifactId>
+                </exclusion>
+            </exclusions>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.hive</groupId>
+            <artifactId>hive-jdbc</artifactId>
+            <version>${hive.version}</version>
+            <scope>test</scope>
+            <exclusions>
+                <exclusion>
+                    <groupId>log4j</groupId>
+                    <artifactId>log4j</artifactId>
+                </exclusion>
+                <exclusion>
+                    <groupId>org.apache.logging.log4j</groupId>
+                    <artifactId>log4j-web</artifactId>
+                </exclusion>
+            </exclusions>
         </dependency>
     </dependencies>
 
diff --git 
a/seatunnel-e2e/seatunnel-connector-v2-e2e/connector-hive-e2e/src/test/java/org/apache/seatunnel/e2e/connector/hive/HiveContainer.java
 
b/seatunnel-e2e/seatunnel-connector-v2-e2e/connector-hive-e2e/src/test/java/org/apache/seatunnel/e2e/connector/hive/HiveContainer.java
new file mode 100644
index 0000000000..486ad0b8b6
--- /dev/null
+++ 
b/seatunnel-e2e/seatunnel-connector-v2-e2e/connector-hive-e2e/src/test/java/org/apache/seatunnel/e2e/connector/hive/HiveContainer.java
@@ -0,0 +1,120 @@
+/*
+ * 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.hive;
+
+import org.apache.hadoop.hive.conf.HiveConf;
+import org.apache.hadoop.hive.metastore.HiveMetaStoreClient;
+import org.apache.hadoop.hive.metastore.api.MetaException;
+
+import org.testcontainers.containers.GenericContainer;
+import org.testcontainers.containers.output.Slf4jLogConsumer;
+import org.testcontainers.containers.wait.strategy.Wait;
+import org.testcontainers.containers.wait.strategy.WaitStrategy;
+import org.testcontainers.utility.DockerImageName;
+import org.testcontainers.utility.DockerLoggerFactory;
+
+import java.sql.Connection;
+import java.sql.Driver;
+import java.sql.SQLException;
+import java.util.Properties;
+
+public class HiveContainer extends GenericContainer<HiveContainer> {
+    public static final String IMAGE = "apache/hive";
+    public static final String DEFAULT_TAG = "3.1.3";
+
+    private static final DockerImageName DEFAULT_IMAGE_NAME = 
DockerImageName.parse(IMAGE);
+
+    public static final int HIVE_SERVER_PORT = 10000;
+
+    public static final int HMS_PORT = 9083;
+
+    private static final String SERVICE_NAME_ENV = "SERVICE_NAME";
+
+    private static final String DRIVER_CLASS_NAME = 
"org.apache.hive.jdbc.HiveDriver";
+
+    public HiveContainer(Role role) {
+        super(DEFAULT_IMAGE_NAME.withTag(DEFAULT_TAG));
+        this.addExposedPorts(role.exposePort);
+        this.addEnv(SERVICE_NAME_ENV, role.serviceName);
+        this.setWaitStrategy(role.waitStrategy);
+        this.withLogConsumer(
+                new Slf4jLogConsumer(
+                        DockerLoggerFactory.getLogger(
+                                
DEFAULT_IMAGE_NAME.withTag(DEFAULT_TAG).toString())));
+    }
+
+    public static HiveContainer hmsStandalone() {
+        return new HiveContainer(Role.HMS_STANDALONE);
+    }
+
+    public static HiveContainer hiveServer() {
+        return new HiveContainer(Role.HIVE_SERVER_WITH_EMBEDDING_HMS);
+    }
+
+    public String getMetastoreUri() {
+        return String.format("thrift://%s:%s", getHost(), 
getMappedPort(HMS_PORT));
+    }
+
+    public String getHiveJdbcUri() {
+        return String.format(
+                "jdbc:hive2://%s:%s/default", getHost(), 
getMappedPort(HIVE_SERVER_PORT));
+    }
+
+    public HiveMetaStoreClient createMetaStoreClient() throws MetaException {
+        HiveConf conf = new HiveConf();
+        conf.set("hive.metastore.uris", getMetastoreUri());
+
+        return new HiveMetaStoreClient(conf);
+    }
+
+    public Connection getConnection()
+            throws ClassNotFoundException, InstantiationException, 
IllegalAccessException,
+                    SQLException {
+        Driver driver = loadHiveJdbcDriver();
+
+        return driver.connect(getHiveJdbcUri(), getJdbcConnectionConfig());
+    }
+
+    public Driver loadHiveJdbcDriver()
+            throws ClassNotFoundException, InstantiationException, 
IllegalAccessException {
+        return (Driver) Class.forName(DRIVER_CLASS_NAME).newInstance();
+    }
+
+    public Properties getJdbcConnectionConfig() {
+        Properties props = new Properties();
+
+        return props;
+    }
+
+    public enum Role {
+        HIVE_SERVER_WITH_EMBEDDING_HMS(
+                "hiveserver2", HIVE_SERVER_PORT, 
Wait.forLogMessage(".*Starting HiveServer2.*", 1)),
+        HMS_STANDALONE(
+                "metastore", HMS_PORT, Wait.forLogMessage(".*Starting Hive 
Metastore Server.*", 1));
+
+        private final String serviceName;
+        private final int exposePort;
+        private final WaitStrategy waitStrategy;
+
+        Role(String serviceName, int exposePort, WaitStrategy waitStrategy) {
+            this.serviceName = serviceName;
+            this.exposePort = exposePort;
+            this.waitStrategy = waitStrategy;
+        }
+    }
+}
diff --git 
a/seatunnel-e2e/seatunnel-connector-v2-e2e/connector-hive-e2e/src/test/java/org/apache/seatunnel/e2e/connector/hive/HiveIT.java
 
b/seatunnel-e2e/seatunnel-connector-v2-e2e/connector-hive-e2e/src/test/java/org/apache/seatunnel/e2e/connector/hive/HiveIT.java
index fbe0b2503b..5973d69758 100644
--- 
a/seatunnel-e2e/seatunnel-connector-v2-e2e/connector-hive-e2e/src/test/java/org/apache/seatunnel/e2e/connector/hive/HiveIT.java
+++ 
b/seatunnel-e2e/seatunnel-connector-v2-e2e/connector-hive-e2e/src/test/java/org/apache/seatunnel/e2e/connector/hive/HiveIT.java
@@ -17,6 +17,7 @@
 
 package org.apache.seatunnel.e2e.connector.hive;
 
+import org.apache.seatunnel.common.utils.ExceptionUtils;
 import org.apache.seatunnel.e2e.common.TestResource;
 import org.apache.seatunnel.e2e.common.TestSuiteBase;
 import org.apache.seatunnel.e2e.common.container.ContainerExtendedFactory;
@@ -25,34 +26,53 @@ import 
org.apache.seatunnel.e2e.common.container.TestContainer;
 import org.apache.seatunnel.e2e.common.junit.DisabledOnContainer;
 import org.apache.seatunnel.e2e.common.junit.TestContainerExtension;
 
+import org.junit.jupiter.api.AfterAll;
 import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.BeforeAll;
 import org.junit.jupiter.api.Disabled;
 import org.junit.jupiter.api.TestTemplate;
 import org.testcontainers.containers.Container;
-import org.testcontainers.utility.MountableFile;
+import org.testcontainers.lifecycle.Startables;
 
 import lombok.extern.slf4j.Slf4j;
 
-import java.io.File;
 import java.io.IOException;
+import java.sql.Connection;
+import java.sql.SQLException;
+import java.sql.Statement;
+import java.time.Duration;
+import java.util.Collections;
+import java.util.concurrent.TimeUnit;
+import java.util.stream.Stream;
+
+import static org.awaitility.Awaitility.given;
 
 @DisabledOnContainer(
         value = {},
         type = {EngineType.SPARK, EngineType.FLINK})
-@Disabled(
-        "[HDFS/COS/OSS/S3] is not available in CI, if you want to run this 
test, please set up your own environment in the test case file, 
hadoop_hive_conf_path_local and ip below}")
 @Slf4j
 public class HiveIT extends TestSuiteBase implements TestResource {
-    private static final String HADOOP_HIVE_CONF_PATH_LOCAL =
-            "/Users/dailai/software/hadoop-3.3.3/etc/hadoop";
-    private static final String HADOOP_HIVE_CONF_PATH_IN_CONTAINER = 
"/tmp/hadoop";
+    private static final String CREATE_SQL =
+            "CREATE TABLE test_hive_sink_on_hdfs"
+                    + "("
+                    + "    pk_id  BIGINT,"
+                    + "    name   STRING,"
+                    + "    score  INT"
+                    + ")";
+
+    private static final String HMS_HOST = "metastore";
+    private static final String HIVE_SERVER_HOST = "hiveserver2";
 
     private String hiveExeUrl() {
-        return 
"https://repo1.maven.org/maven2/org/apache/hive/hive-exec/2.3.9/hive-exec-2.3.9.jar";;
+        return 
"https://repo1.maven.org/maven2/org/apache/hive/hive-exec/3.1.3/hive-exec-3.1.3.jar";;
+    }
+
+    private String libFb303Url() {
+        return 
"https://repo1.maven.org/maven2/org/apache/thrift/libfb303/0.9.3/libfb303-0.9.3.jar";;
     }
 
     private String hadoopAwsUrl() {
-        return 
"https://repo1.maven.org/maven2/org/apache/hadoop/hadoop-aws/2.6.5/hadoop-aws-2.6.5.jar";;
+        return 
"https://repo1.maven.org/maven2/org/apache/hadoop/hadoop-aws/3.1.4/hadoop-aws-3.1.4.jar";;
     }
 
     private String aliyunSdkOssUrl() {
@@ -71,42 +91,40 @@ public class HiveIT extends TestSuiteBase implements 
TestResource {
         return 
"https://repo1.maven.org/maven2/com/qcloud/cos/hadoop-cos/2.6.5-8.0.2/hadoop-cos-2.6.5-8.0.2.jar";;
     }
 
+    private HiveContainer hiveServerContainer;
+    private HiveContainer hmsContainer;
+    private Connection hiveConnection;
+    private String pluginHiveDir = "/tmp/seatunnel/plugins/Hive/lib";
+
     @TestContainerExtension
     protected final ContainerExtendedFactory extendedFactory =
             container -> {
-                container.execInContainer("sh", "-c", "chmod -R 777 
/etc/hosts");
-                container.execInContainer("sh", "-c", "echo \"${IP01} 
hadoop01\" >> /etc/hosts");
-                container.execInContainer("sh", "-c", "echo \"${IP02} 
hadoop02\" >> /etc/hosts");
-                container.execInContainer("sh", "-c", "echo \"${IP03} 
hadoop03\" >> /etc/hosts");
-                container.execInContainer("sh", "-c", "echo \"${IP04} 
hadoop04\" >> /etc/hosts");
-                container.execInContainer("sh", "-c", "echo \"${IP05} 
hadoop05\" >> /etc/hosts");
-                container.execInContainer("sh", "-c", "echo \"${IP06} 
hadoop06\" >> /etc/hosts");
-                Assertions.assertTrue(
-                        new File(HADOOP_HIVE_CONF_PATH_LOCAL).exists(),
-                        HADOOP_HIVE_CONF_PATH_LOCAL + " must exist");
-                container.execInContainer(
-                        "sh", "-c", "mkdir -p " + 
HADOOP_HIVE_CONF_PATH_IN_CONTAINER);
-                container.execInContainer(
-                        "sh", "-c", "chmod -R 777 " + 
HADOOP_HIVE_CONF_PATH_IN_CONTAINER);
-                // Copy local hadoop conf and hive conf to the container
-                container.copyFileToContainer(
-                        MountableFile.forHostPath(HADOOP_HIVE_CONF_PATH_LOCAL),
-                        HADOOP_HIVE_CONF_PATH_IN_CONTAINER);
-
                 // The jar of hive-exec
-                Container.ExecResult extraCommands =
+                Container.ExecResult downloadHiveExeCommands =
                         container.execInContainer(
                                 "sh",
                                 "-c",
-                                "mkdir -p /tmp/seatunnel/plugins/Hive/lib && 
cd /tmp/seatunnel/plugins/Hive/lib && wget "
+                                "mkdir -p "
+                                        + pluginHiveDir
+                                        + " && cd "
+                                        + pluginHiveDir
+                                        + " && wget "
                                         + hiveExeUrl());
-                Assertions.assertEquals(0, extraCommands.getExitCode(), 
extraCommands.getStderr());
+                Assertions.assertEquals(
+                        0,
+                        downloadHiveExeCommands.getExitCode(),
+                        downloadHiveExeCommands.getStderr());
+                Container.ExecResult downloadLibFb303Commands =
+                        container.execInContainer(
+                                "sh", "-c", "cd " + pluginHiveDir + " && wget 
" + libFb303Url());
+                Assertions.assertEquals(
+                        0,
+                        downloadLibFb303Commands.getExitCode(),
+                        downloadLibFb303Commands.getStderr());
                 // The jar of s3
                 Container.ExecResult downloadS3Commands =
                         container.execInContainer(
-                                "sh",
-                                "-c",
-                                "cd /tmp/seatunnel/plugins/Hive/lib && wget " 
+ hadoopAwsUrl());
+                                "sh", "-c", "cd " + pluginHiveDir + " && wget 
" + hadoopAwsUrl());
                 Assertions.assertEquals(
                         0, downloadS3Commands.getExitCode(), 
downloadS3Commands.getStderr());
                 // The jar of oss
@@ -114,7 +132,9 @@ public class HiveIT extends TestSuiteBase implements 
TestResource {
                         container.execInContainer(
                                 "sh",
                                 "-c",
-                                "cd /tmp/seatunnel/plugins/Hive/lib && wget "
+                                "cd "
+                                        + pluginHiveDir
+                                        + " && wget "
                                         + aliyunSdkOssUrl()
                                         + " && wget "
                                         + jdomUrl()
@@ -125,21 +145,80 @@ public class HiveIT extends TestSuiteBase implements 
TestResource {
                 // The jar of cos
                 Container.ExecResult downloadCosCommands =
                         container.execInContainer(
-                                "sh",
-                                "-c",
-                                "cd /tmp/seatunnel/plugins/Hive/lib && wget " 
+ hadoopCosUrl());
+                                "sh", "-c", "cd " + pluginHiveDir + " && wget 
" + hadoopCosUrl());
                 Assertions.assertEquals(
                         0, downloadCosCommands.getExitCode(), 
downloadCosCommands.getStderr());
             };
 
+    @BeforeAll
     @Override
-    public void startUp() throws Exception {}
+    public void startUp() throws Exception {
+        hmsContainer =
+                HiveContainer.hmsStandalone()
+                        .withCreateContainerCmdModifier(cmd -> 
cmd.withName(HMS_HOST))
+                        .withNetwork(NETWORK)
+                        .withNetworkAliases(HMS_HOST);
+        hmsContainer.setPortBindings(Collections.singletonList("9083:9083"));
+
+        Startables.deepStart(Stream.of(hmsContainer)).join();
+        log.info("HMS just started");
+
+        hiveServerContainer =
+                HiveContainer.hiveServer()
+                        .withNetwork(NETWORK)
+                        .withCreateContainerCmdModifier(cmd -> 
cmd.withName(HIVE_SERVER_HOST))
+                        .withNetworkAliases(HIVE_SERVER_HOST)
+                        .withFileSystemBind("/tmp/data", "/opt/hive/data")
+                        .withEnv("SERVICE_OPTS", 
"-Dhive.metastore.uris=thrift://metastore:9083")
+                        .withEnv("IS_RESUME", "true")
+                        .dependsOn(hmsContainer);
+        
hiveServerContainer.setPortBindings(Collections.singletonList("10000:10000"));
+
+        Startables.deepStart(Stream.of(hiveServerContainer)).join();
+        log.info("HiveServer2 just started");
+        given().ignoreExceptions()
+                .await()
+                .atMost(360, TimeUnit.SECONDS)
+                .pollDelay(Duration.ofSeconds(10L))
+                .untilAsserted(this::initializeConnection);
+        prepareTable();
+    }
 
+    @AfterAll
     @Override
-    public void tearDown() throws Exception {}
+    public void tearDown() throws Exception {
+        if (hmsContainer != null) {
+            log.info(hmsContainer.execInContainer("cat", 
"/tmp/hive/hive.log").getStdout());
+            hmsContainer.close();
+        }
+        if (hiveServerContainer != null) {
+            log.info(hiveServerContainer.execInContainer("cat", 
"/tmp/hive/hive.log").getStdout());
+            hiveServerContainer.close();
+        }
+    }
+
+    private void initializeConnection()
+            throws ClassNotFoundException, InstantiationException, 
IllegalAccessException,
+                    SQLException {
+        this.hiveConnection = this.hiveServerContainer.getConnection();
+    }
+
+    private void prepareTable() throws Exception {
+        log.info(
+                String.format(
+                        "Databases are %s",
+                        
this.hmsContainer.createMetaStoreClient().getAllDatabases()));
+        try (Statement statement = this.hiveConnection.createStatement()) {
+            statement.execute(CREATE_SQL);
+        } catch (Exception exception) {
+            log.error(ExceptionUtils.getMessage(exception));
+            throw exception;
+        }
+    }
 
     private void executeJob(TestContainer container, String job1, String job2)
             throws IOException, InterruptedException {
+
         Container.ExecResult execResult = container.executeJob(job1);
         Assertions.assertEquals(0, execResult.getExitCode());
 
@@ -153,16 +232,22 @@ public class HiveIT extends TestSuiteBase implements 
TestResource {
     }
 
     @TestTemplate
+    @Disabled(
+            "[HDFS/COS/OSS/S3] is not available in CI, if you want to run this 
test, please set up your own environment in the test case file, 
hadoop_hive_conf_path_local and ip below}")
     public void testFakeSinkHiveOnS3(TestContainer container) throws Exception 
{
         executeJob(container, "/fake_to_hive_on_s3.conf", 
"/hive_on_s3_to_assert.conf");
     }
 
     @TestTemplate
+    @Disabled(
+            "[HDFS/COS/OSS/S3] is not available in CI, if you want to run this 
test, please set up your own environment in the test case file, 
hadoop_hive_conf_path_local and ip below}")
     public void testFakeSinkHiveOnOSS(TestContainer container) throws 
Exception {
         executeJob(container, "/fake_to_hive_on_oss.conf", 
"/hive_on_oss_to_assert.conf");
     }
 
     @TestTemplate
+    @Disabled(
+            "[HDFS/COS/OSS/S3] is not available in CI, if you want to run this 
test, please set up your own environment in the test case file, 
hadoop_hive_conf_path_local and ip below}")
     public void testFakeSinkHiveOnCos(TestContainer container) throws 
Exception {
         executeJob(container, "/fake_to_hive_on_cos.conf", 
"/hive_on_cos_to_assert.conf");
     }
diff --git 
a/seatunnel-e2e/seatunnel-connector-v2-e2e/connector-hive-e2e/src/test/resources/fake_to_hive_on_hdfs.conf
 
b/seatunnel-e2e/seatunnel-connector-v2-e2e/connector-hive-e2e/src/test/resources/fake_to_hive_on_hdfs.conf
index db0e9cdc6c..013490374c 100644
--- 
a/seatunnel-e2e/seatunnel-connector-v2-e2e/connector-hive-e2e/src/test/resources/fake_to_hive_on_hdfs.conf
+++ 
b/seatunnel-e2e/seatunnel-connector-v2-e2e/connector-hive-e2e/src/test/resources/fake_to_hive_on_hdfs.conf
@@ -52,8 +52,7 @@ source {
 
 sink {
   Hive {
-    table_name = "test_hive.test_hive_sink_on_hdfs"
-    metastore_uri = "thrift://hadoop04:9083"
-    hive.hadoop.conf-path = "/tmp/hadoop"
+    table_name = "default.test_hive_sink_on_hdfs"
+    metastore_uri = "thrift://metastore:9083"
   }
 }
diff --git 
a/seatunnel-e2e/seatunnel-connector-v2-e2e/connector-hive-e2e/src/test/resources/hive_on_hdfs_to_assert.conf
 
b/seatunnel-e2e/seatunnel-connector-v2-e2e/connector-hive-e2e/src/test/resources/hive_on_hdfs_to_assert.conf
index 87df421a2d..0f1fba40f0 100644
--- 
a/seatunnel-e2e/seatunnel-connector-v2-e2e/connector-hive-e2e/src/test/resources/hive_on_hdfs_to_assert.conf
+++ 
b/seatunnel-e2e/seatunnel-connector-v2-e2e/connector-hive-e2e/src/test/resources/hive_on_hdfs_to_assert.conf
@@ -22,8 +22,8 @@ env {
 
 source {
   Hive {
-    table_name = "test_hive.test_hive_sink_on_hdfs"
-    metastore_uri = "thrift://hadoop04:9083"
+    table_name = "default.test_hive_sink_on_hdfs"
+    metastore_uri = "thrift://metastore:9083"
     hive.hadoop.conf-path = "/tmp/hadoop"
     result_table_name = hive_source
   }
diff --git 
a/seatunnel-e2e/seatunnel-e2e-common/src/test/java/org/apache/seatunnel/e2e/common/container/TestContainer.java
 
b/seatunnel-e2e/seatunnel-e2e-common/src/test/java/org/apache/seatunnel/e2e/common/container/TestContainer.java
index b55cbae6c7..fd49c7b46e 100644
--- 
a/seatunnel-e2e/seatunnel-e2e-common/src/test/java/org/apache/seatunnel/e2e/common/container/TestContainer.java
+++ 
b/seatunnel-e2e/seatunnel-e2e-common/src/test/java/org/apache/seatunnel/e2e/common/container/TestContainer.java
@@ -24,10 +24,15 @@ import org.testcontainers.containers.Network;
 
 import java.io.IOException;
 import java.util.List;
+import java.util.UUID;
 
 public interface TestContainer extends TestResource {
 
-    Network NETWORK = Network.newNetwork();
+    Network NETWORK =
+            Network.builder()
+                    .createNetworkCmdModifier(cmd -> cmd.withName("SEATUNNEL-" 
+ UUID.randomUUID()))
+                    .enableIpv6(false)
+                    .build();
 
     TestContainerId identifier();
 
diff --git 
a/seatunnel-e2e/seatunnel-e2e-common/src/test/java/org/apache/seatunnel/e2e/common/container/seatunnel/SeaTunnelContainer.java
 
b/seatunnel-e2e/seatunnel-e2e-common/src/test/java/org/apache/seatunnel/e2e/common/container/seatunnel/SeaTunnelContainer.java
index 03a0f87be8..5fa5abb7ed 100644
--- 
a/seatunnel-e2e/seatunnel-e2e-common/src/test/java/org/apache/seatunnel/e2e/common/container/seatunnel/SeaTunnelContainer.java
+++ 
b/seatunnel-e2e/seatunnel-e2e-common/src/test/java/org/apache/seatunnel/e2e/common/container/seatunnel/SeaTunnelContainer.java
@@ -94,6 +94,7 @@ public class SeaTunnelContainer extends AbstractTestContainer 
{
                         .withCommand(buildStartCommand())
                         .withNetworkAliases("server")
                         .withExposedPorts()
+                        .withFileSystemBind("/tmp", "/opt/hive")
                         .withLogConsumer(
                                 new Slf4jLogConsumer(
                                         DockerLoggerFactory.getLogger(

Reply via email to