Skip to content

Commit

Permalink
mvnd IT: increase connectTimeout for ITs (#1171)
Browse files Browse the repository at this point in the history
Experiment PR to figure out why MacOS GH runners keep failing with transport related (SSL handshake abort, HTTP timeouts) errors. As we know linux and windows boxes are in Azure, while macos boxes are somewhere else, and we get regularly real strange errors like "SSL handshake errors", "HTTP timeout error (against Central?)", so suspicion is on JDK transport (in HTTP/2 mode).

Experiments:
* force apache transport (HTTP/1.1) - ✔️ 
* force JDK transport into HTTP/1.1 - 🟥 
* use big timeout for connectTimeout - ✔️ 

Conclusion: for ITs we will for now increase the default (10sec) `connectTimeout` Resolver configuration, as it seems too low.
  • Loading branch information
cstamas authored Oct 17, 2024
1 parent 9734734 commit 11a6ed3
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@
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;
Expand All @@ -47,7 +49,7 @@ public ExecutionResult execute(ClientOutput output, List<String> argv) {
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());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@
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.
*/
Expand Down Expand Up @@ -66,7 +68,8 @@ private void add(Environment env, Collection<String> args, Supplier<Object> supp
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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,25 @@
import java.io.IOException;
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.transport.http.connectTimeout"))) {
result.add("-Daether.transport.http.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 {
Expand Down

0 comments on commit 11a6ed3

Please sign in to comment.