hawk9821 commented on code in PR #10402:
URL: https://github.com/apache/seatunnel/pull/10402#discussion_r2791138836
##########
seatunnel-e2e/seatunnel-connector-v2-e2e/connector-file-local-e2e/src/test/java/org/apache/seatunnel/e2e/connector/file/local/LocalFileIT.java:
##########
@@ -70,9 +70,9 @@
import java.util.zip.ZipOutputStream;
@DisabledOnContainer(
- value = {TestContainerId.SPARK_2_4},
- type = {},
- disabledReason = "The apache-compress version is not compatible with
apache-poi")
+ value = {},
+ type = {EngineType.SPARK, EngineType.FLINK},
Review Comment:
Why disable Spark and Flink use cases ?
##########
seatunnel-e2e/seatunnel-connector-v2-e2e/connector-file-local-e2e/src/test/java/org/apache/seatunnel/e2e/connector/file/local/LocalFileWithMetaLakeIT.java:
##########
@@ -0,0 +1,387 @@
+/*
+ * 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.file.local;
+
+import org.apache.seatunnel.e2e.common.container.ContainerExtendedFactory;
+import org.apache.seatunnel.e2e.common.container.seatunnel.SeaTunnelContainer;
+import org.apache.seatunnel.e2e.common.junit.TestContainerExtension;
+import org.apache.seatunnel.e2e.common.util.ContainerUtil;
+
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.testcontainers.containers.GenericContainer;
+import org.testcontainers.containers.MySQLContainer;
+import org.testcontainers.containers.output.Slf4jLogConsumer;
+import org.testcontainers.containers.wait.strategy.Wait;
+import org.testcontainers.images.PullPolicy;
+import org.testcontainers.utility.DockerImageName;
+import org.testcontainers.utility.DockerLoggerFactory;
+import org.testcontainers.utility.MountableFile;
+
+import lombok.extern.slf4j.Slf4j;
+
+import java.nio.file.Paths;
+import java.util.Arrays;
+import java.util.Collections;
+
+import static
org.apache.seatunnel.e2e.common.util.ContainerUtil.PROJECT_ROOT_PATH;
+
+@Slf4j
+public class LocalFileWithMetaLakeIT extends SeaTunnelContainer {
+
+ private static final String GRAVITINO_IMAGE = "apache/gravitino:latest";
+ private static final int GRAVITINO_PORT = 8090;
+
+ private static final String MYSQL_IMAGE = "mysql:8.0.43";
+ private static final String MYSQL_CONTAINER_HOST = "mysql-e2e";
+ private static final String MYSQL_DATABASE = "seatunnel";
+ private static final String MYSQL_USERNAME = "root";
+ private static final String MYSQL_PASSWORD = "Abc!@#135_seatunnel";
+ private static final int MYSQL_PORT = 3306;
+
+ private GenericContainer<?> gravitinoContainer;
+ private GenericContainer<?> mysqlContainer;
+
+ @TestContainerExtension
+ private final ContainerExtendedFactory extendedFactory =
+ container -> {
+ // Copy CSV data files from resources to container
+ ContainerUtil.copyFileIntoContainers(
+ "/csv/data/table1.csv",
+ "/seatunnel/read/metalake/table1/data.csv",
+ container);
+ ContainerUtil.copyFileIntoContainers(
+ "/csv/data/table2.csv",
+ "/seatunnel/read/metalake/table2/data.csv",
+ container);
+ };
+
+ @BeforeEach
+ @Override
+ public void startUp() throws Exception {
+ // Start MySQL container first as metadata storage
+ startMySQLContainer();
+ // Start Gravitino server with MySQL as backend
+ startGravitinoServer();
+ // Start SeaTunnel server with MetaLake enabled
+ server =
+ new GenericContainer<>(getDockerImage())
+ .withNetwork(NETWORK)
+ .withEnv("TZ", "UTC")
+ .withCommand(buildStartCommand())
+ .withNetworkAliases("server")
+ .withExposedPorts()
+ .withFileSystemBind("/tmp", "/opt/hive")
+ .withLogConsumer(
+ new Slf4jLogConsumer(
+ DockerLoggerFactory.getLogger(
+ "seatunnel-engine:" +
JDK_DOCKER_IMAGE)))
+ .waitingFor(Wait.forLogMessage(".*received new worker
register:.*", 1));
+ copySeaTunnelStarterToContainer(server);
+ server.setPortBindings(Arrays.asList("5801:5801", "8080:8080"));
+ server.withCopyFileToContainer(
+ MountableFile.forHostPath(
+ PROJECT_ROOT_PATH
+ +
"/seatunnel-e2e/seatunnel-engine-e2e/connector-seatunnel-e2e-base/src/test/resources/"),
+ Paths.get(SEATUNNEL_HOME, "config").toString());
+
+ server.withCopyFileToContainer(
+ MountableFile.forHostPath(
+ PROJECT_ROOT_PATH
+ +
"/seatunnel-shade/seatunnel-hadoop3-3.1.4-uber/target/seatunnel-hadoop3-3.1.4-uber.jar"),
+ Paths.get(SEATUNNEL_HOME,
"lib/seatunnel-hadoop3-3.1.4-uber.jar").toString());
+
+ server.start();
+ // execute extra commands (including copying CSV files via
extendedFactory)
+ // This must be called after server.start() because
copyFileToContainer requires a running
+ // container
+ executeExtraCommands(extendedFactory);
+ }
+
+ @AfterEach
+ @Override
+ public void tearDown() throws Exception {
+ // Close containers in reverse order of creation
+ if (server != null) {
+ server.close();
+ }
+ if (gravitinoContainer != null) {
+ gravitinoContainer.close();
+ }
+ if (mysqlContainer != null) {
+ mysqlContainer.close();
+ }
+ // Note: Not calling super.tearDown() because:
+ // 1. This test overrides startUp() and doesn't use
CONTAINER_VOLUME_MOUNT_PATH
+ // 2. Parent's tearDown tries to execInContainer on server which fails
if already closed
+ }
+
+ private void startMySQLContainer() throws Exception {
+ DockerImageName imageName = DockerImageName.parse(MYSQL_IMAGE);
+ mysqlContainer =
+ new MySQLContainer<>(imageName)
+ .withUsername(MYSQL_USERNAME)
+ .withPassword(MYSQL_PASSWORD)
+ .withDatabaseName(MYSQL_DATABASE)
+ .withNetwork(NETWORK)
+ .withNetworkAliases(MYSQL_CONTAINER_HOST)
+ .withExposedPorts(MYSQL_PORT)
+ .withImagePullPolicy(PullPolicy.alwaysPull())
+ .waitingFor(Wait.forHealthcheck())
+ .withLogConsumer(
+ new
Slf4jLogConsumer(DockerLoggerFactory.getLogger(MYSQL_IMAGE)));
+ mysqlContainer.setPortBindings(
+ Collections.singletonList(String.format("%s:%s", MYSQL_PORT,
MYSQL_PORT)));
+ mysqlContainer.start();
+ log.info("MySQL container started at {}", mysqlContainer.getHost());
+ // Wait for MySQL to be fully ready
+ Thread.sleep(10000);
+ }
+
+ private void startGravitinoServer() throws Exception {
+ gravitinoContainer =
+ new GenericContainer<>(GRAVITINO_IMAGE)
+ .withNetwork(NETWORK)
+ .withNetworkAliases("gravitino")
+ .withExposedPorts(GRAVITINO_PORT)
+ .withLogConsumer(
+ new Slf4jLogConsumer(
+ DockerLoggerFactory.getLogger(
+ "gravitino:" +
GRAVITINO_IMAGE)));
+ gravitinoContainer.setPortBindings(
+ Collections.singletonList(String.format("%s:%s",
GRAVITINO_PORT, GRAVITINO_PORT)));
+ gravitinoContainer.start();
+ // Wait for Gravitino to be ready by checking the API endpoint
+ waitForGravitinoReady();
+ log.info("Gravitino server started at {}",
gravitinoContainer.getHost());
+ // Create metalake and catalog using curl with MySQL as backend
+ createMetalakeAndCatalog();
+ }
+
+ private void waitForGravitinoReady() throws Exception {
+ int maxAttempts = 60;
+ int attempt = 0;
+ while (attempt < maxAttempts) {
Review Comment:
Can the stability of CI be guaranteed ?
--
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]