You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@seatunnel.apache.org by ga...@apache.org on 2022/09/08 06:21:12 UTC

[incubator-seatunnel] branch dev updated: [Bug][e2e] the e2e exec error in win10, fix path separator (#2633)

This is an automated email from the ASF dual-hosted git repository.

gaojun2048 pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/incubator-seatunnel.git


The following commit(s) were added to refs/heads/dev by this push:
     new 32c32ef23 [Bug][e2e] the e2e exec error in win10, fix path separator (#2633)
32c32ef23 is described below

commit 32c32ef238fd9c365f78bfa94a396423fc291ed0
Author: Laglangyue <35...@users.noreply.github.com>
AuthorDate: Thu Sep 8 14:21:06 2022 +0800

    [Bug][e2e] the e2e exec error in win10, fix path separator (#2633)
    
    * fix the e2e exec error in win10-os,because line separator.
---
 .../org/apache/seatunnel/e2e/spark/SparkContainer.java    | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/seatunnel-e2e/seatunnel-spark-connector-v2-e2e/connector-spark-e2e-base/src/test/java/org/apache/seatunnel/e2e/spark/SparkContainer.java b/seatunnel-e2e/seatunnel-spark-connector-v2-e2e/connector-spark-e2e-base/src/test/java/org/apache/seatunnel/e2e/spark/SparkContainer.java
index 984ecfe88..2f74483f0 100644
--- a/seatunnel-e2e/seatunnel-spark-connector-v2-e2e/connector-spark-e2e-base/src/test/java/org/apache/seatunnel/e2e/spark/SparkContainer.java
+++ b/seatunnel-e2e/seatunnel-spark-connector-v2-e2e/connector-spark-e2e-base/src/test/java/org/apache/seatunnel/e2e/spark/SparkContainer.java
@@ -94,15 +94,14 @@ public abstract class SparkContainer {
         master.copyFileToContainer(MountableFile.forHostPath(confPath), targetConfInContainer);
 
         // TODO: use start-seatunnel-spark.sh to run the spark job. Need to modified the SparkStarter can find the seatunnel-core-spark.jar.
-        // Running IT use cases under Windows requires replacing \ with /
-        String conf = targetConfInContainer.replaceAll("\\\\", "/");
         final List<String> command = new ArrayList<>();
-        command.add(Paths.get(SEATUNNEL_HOME, "bin", SEATUNNEL_SPARK_BIN).toString());
+        String sparkBinPath = Paths.get(SEATUNNEL_HOME, "bin", SEATUNNEL_SPARK_BIN).toString();
+        command.add(adaptPathForWin(sparkBinPath));
         command.add("--master");
         command.add("local");
         command.add("--deploy-mode");
         command.add("client");
-        command.add("--config " + conf);
+        command.add("--config " + adaptPathForWin(targetConfInContainer));
 
         Container.ExecResult execResult = master.execInContainer("bash", "-c", String.join(" ", command));
         LOG.info(execResult.getStdout());
@@ -119,10 +118,10 @@ public abstract class SparkContainer {
         master.copyFileToContainer(MountableFile.forHostPath(seatunnelCoreSparkJarPath), SPARK_JAR_PATH);
 
         // copy bin
-        String seatunnelFlinkBinPath = Paths.get(PROJECT_ROOT_PATH.toString(),
+        String seatunnelSparkBinPath = Paths.get(PROJECT_ROOT_PATH.toString(),
             "seatunnel-core", "seatunnel-spark-starter", "src", "main", "bin", SEATUNNEL_SPARK_BIN).toString();
         master.copyFileToContainer(
-            MountableFile.forHostPath(seatunnelFlinkBinPath),
+            MountableFile.forHostPath(seatunnelSparkBinPath),
             Paths.get(SEATUNNEL_BIN, SEATUNNEL_SPARK_BIN).toString());
 
         // copy connectors
@@ -155,4 +154,8 @@ public abstract class SparkContainer {
                         f -> f.getName().contains("connector-"))))
             .collect(Collectors.toList());
     }
+
+    private String adaptPathForWin(String path) {
+        return path == null ? "" : path.replaceAll("\\\\", "/");
+    }
 }