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

slachiewicz pushed a commit to branch mvnd-1.x
in repository https://gitbox.apache.org/repos/asf/maven-mvnd.git

commit 59c3dd3ff9067ec8a3a9f6a06f7432a66700155c
Author: Tamas Cservenak <[email protected]>
AuthorDate: Thu Oct 17 14:07:05 2024 +0200

    mvnd IT: increase connectTimeout for ITs (#1171)
    
    (cherry picked from commit 11a6ed3528aad82c8352b2074e842472f51d1cc7)
    Uses aether.connector.connectTimeout, the property name resolver 1.9.x 
(Maven 3.9) reads; aether.transport.http.connectTimeout is only known to 
resolver 2.x.
---
 .../test/java/org/mvndaemon/mvnd/junit/JvmTestClient.java |  4 +++-
 .../java/org/mvndaemon/mvnd/junit/NativeTestClient.java   |  5 ++++-
 .../src/test/java/org/mvndaemon/mvnd/junit/TestUtils.java | 15 +++++++++++++++
 3 files changed, 22 insertions(+), 2 deletions(-)

diff --git 
a/integration-tests/src/test/java/org/mvndaemon/mvnd/junit/JvmTestClient.java 
b/integration-tests/src/test/java/org/mvndaemon/mvnd/junit/JvmTestClient.java
index 2357cc11..bf2de0fb 100644
--- 
a/integration-tests/src/test/java/org/mvndaemon/mvnd/junit/JvmTestClient.java
+++ 
b/integration-tests/src/test/java/org/mvndaemon/mvnd/junit/JvmTestClient.java
@@ -32,6 +32,8 @@ import org.mvndaemon.mvnd.client.ExecutionResult;
 import org.mvndaemon.mvnd.common.Environment;
 import org.mvndaemon.mvnd.common.logging.ClientOutput;
 
+import static org.mvndaemon.mvnd.junit.TestUtils.augmentArgs;
+
 public class JvmTestClient extends DefaultClient {
 
     private final DaemonParameters parameters;
@@ -61,7 +63,7 @@ public class JvmTestClient extends DefaultClient {
         if (parameters instanceof TestParameters && ((TestParameters) 
parameters).isNoTransferProgress()) {
             argv.add("-ntp");
         }
-        final ExecutionResult delegate = super.execute(output, argv);
+        final ExecutionResult delegate = super.execute(output, 
augmentArgs(argv));
         if (output instanceof TestClientOutput) {
             return new JvmTestResult(delegate, ((TestClientOutput) 
output).messagesToString());
         }
diff --git 
a/integration-tests/src/test/java/org/mvndaemon/mvnd/junit/NativeTestClient.java
 
b/integration-tests/src/test/java/org/mvndaemon/mvnd/junit/NativeTestClient.java
index 0fb53030..03ae48a6 100644
--- 
a/integration-tests/src/test/java/org/mvndaemon/mvnd/junit/NativeTestClient.java
+++ 
b/integration-tests/src/test/java/org/mvndaemon/mvnd/junit/NativeTestClient.java
@@ -35,6 +35,8 @@ import org.mvndaemon.mvnd.common.Message;
 import org.mvndaemon.mvnd.common.OsUtils.CommandProcess;
 import org.mvndaemon.mvnd.common.logging.ClientOutput;
 
+import static org.mvndaemon.mvnd.junit.TestUtils.augmentArgs;
+
 /**
  * A wrapper around the native executable.
  */
@@ -66,7 +68,8 @@ public class NativeTestClient implements Client {
     public ExecutionResult execute(ClientOutput output, List<String> args) 
throws InterruptedException {
         final List<String> cmd = new ArrayList<>(args.size() + 6);
         cmd.add(mvndNativeExecutablePath.toString());
-        cmd.addAll(args);
+        cmd.addAll(augmentArgs(args));
+
         add(Environment.MVND_DAEMON_STORAGE, cmd, parameters::daemonStorage);
         add(Environment.MAVEN_REPO_LOCAL, cmd, parameters::mavenRepoLocal);
         add(Environment.MAVEN_SETTINGS, cmd, parameters::settings);
diff --git 
a/integration-tests/src/test/java/org/mvndaemon/mvnd/junit/TestUtils.java 
b/integration-tests/src/test/java/org/mvndaemon/mvnd/junit/TestUtils.java
index 3dadeb2d..e0f8fa91 100644
--- a/integration-tests/src/test/java/org/mvndaemon/mvnd/junit/TestUtils.java
+++ b/integration-tests/src/test/java/org/mvndaemon/mvnd/junit/TestUtils.java
@@ -22,10 +22,25 @@ import java.io.IOException;
 import java.nio.charset.StandardCharsets;
 import java.nio.file.Files;
 import java.nio.file.Path;
+import java.util.ArrayList;
 import java.util.Comparator;
+import java.util.List;
 import java.util.stream.Stream;
 
 public class TestUtils {
+    /**
+     * IT circumvention for JDK transport low timeouts and GH macOS runners 
networking issues.
+     * If arguments does not contain settings for timeouts (ie as part of 
test), they will be
+     * added to increase timeouts for IT runs.
+     */
+    public static List<String> augmentArgs(List<String> args) {
+        ArrayList<String> result = new ArrayList<>(args);
+        if (result.stream().noneMatch(s -> 
s.contains("aether.connector.connectTimeout"))) {
+            result.add("-Daether.connector.connectTimeout=1800000");
+        }
+        // note: def value for requestTimeout=1800000; not setting it as it is 
fine
+        return result;
+    }
 
     public static void replace(Path path, String find, String replacement) {
         try {

Reply via email to