Skip to content

Commit

Permalink
Increase tool timeout to reduce flakiness
Browse files Browse the repository at this point in the history
  • Loading branch information
marcphilipp committed Nov 1, 2021
1 parent cd257bd commit 938ab00
Show file tree
Hide file tree
Showing 9 changed files with 19 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.time.Duration;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
Expand All @@ -33,6 +34,8 @@
*/
public class Helper {

public static final Duration TOOL_TIMEOUT = Duration.ofMinutes(3);

private static final Path ROOT = Paths.get("..");
private static final Path GRADLE_PROPERTIES = ROOT.resolve("gradle.properties");
private static final Path SETTINGS_GRADLE = ROOT.resolve("settings.gradle.kts");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue;

import java.time.Duration;
import static platform.tooling.support.Helper.TOOL_TIMEOUT;

import de.sormuras.bartholdy.tool.GradleWrapper;

Expand All @@ -37,7 +36,7 @@ void gradle_wrapper() {
.setProject("gradle-kotlin-extensions") //
.addArguments("-Dmaven.repo=" + MavenRepo.dir()) //
.addArguments("build", "--no-daemon", "--stacktrace") //
.setTimeout(Duration.ofMinutes(2)) //
.setTimeout(TOOL_TIMEOUT) //
.setJavaHome(Helper.getJavaHome("8").orElseThrow(TestAbortedException::new)) //
.build() //
.run();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertLinesMatch;
import static platform.tooling.support.Helper.TOOL_TIMEOUT;

import java.nio.file.Paths;
import java.time.Duration;
import java.util.List;

import de.sormuras.bartholdy.Tool;
Expand Down Expand Up @@ -47,7 +47,7 @@ private void test(Tool gradle) {
.addArguments("-Dmaven.repo=" + MavenRepo.dir()) //
.addArguments("build", "--no-daemon", "--debug", "--stacktrace") //
.setJavaHome(Helper.getJavaHome("8").orElseThrow(TestAbortedException::new)) //
.setTimeout(Duration.ofMinutes(2)).build() //
.setTimeout(TOOL_TIMEOUT).build() //
.run();

assertFalse(result.isTimedOut(), () -> "tool timed out: " + result);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static platform.tooling.support.Helper.TOOL_TIMEOUT;

import java.nio.file.Paths;
import java.time.Duration;

import de.sormuras.bartholdy.tool.GradleWrapper;

Expand All @@ -39,7 +39,7 @@ void gradle_wrapper() {
.setProject("gradle-starter") //
.addArguments("-Dmaven.repo=" + MavenRepo.dir()) //
.addArguments("build", "--no-daemon", "--stacktrace") //
.setTimeout(Duration.ofMinutes(2)) //
.setTimeout(TOOL_TIMEOUT) //
.setJavaHome(Helper.getJavaHome("8").orElseThrow(TestAbortedException::new)) //
.build() //
.run();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.junit.jupiter.api.Assumptions.assumeTrue;
import static platform.tooling.support.Helper.TOOL_TIMEOUT;

import java.nio.file.Path;
import java.time.Duration;
import java.util.List;

import de.sormuras.bartholdy.tool.Java;
Expand Down Expand Up @@ -55,7 +55,7 @@ List<String> execute(String version, Path javaHome) {
.setWorkspace("java-versions-" + version) //
.addArguments("-Dmaven.repo=" + MavenRepo.dir()) //
.addArguments("--debug", "--batch-mode", "verify") //
.setTimeout(Duration.ofMinutes(2)) //
.setTimeout(TOOL_TIMEOUT) //
.setJavaHome(javaHome) //
.build().run();
assertFalse(result.isTimedOut(), () -> "tool timed out: " + result);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue;

import java.time.Duration;
import static platform.tooling.support.Helper.TOOL_TIMEOUT;

import org.junit.jupiter.api.Test;
import org.opentest4j.TestAbortedException;
Expand All @@ -36,7 +35,7 @@ void verifyMavenStarterProject() {
.setProject("maven-starter") //
.addArguments("-Dmaven.repo=" + MavenRepo.dir()) //
.addArguments("--debug", "--batch-mode", "verify") //
.setTimeout(Duration.ofMinutes(2)) //
.setTimeout(TOOL_TIMEOUT) //
.setJavaHome(Helper.getJavaHome("8").orElseThrow(TestAbortedException::new)) //
.build() //
.run();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertLinesMatch;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static platform.tooling.support.Helper.TOOL_TIMEOUT;

import java.nio.file.Files;
import java.nio.file.Path;
import java.time.Duration;
import java.util.List;

import de.sormuras.bartholdy.Result;
Expand Down Expand Up @@ -85,7 +85,7 @@ private Result mvn(String variant) {
.setProject("multi-release-jar") //
.addArguments("-Dmaven.repo=" + MavenRepo.dir()) //
.addArguments("--show-version", "--errors", "--batch-mode", "--file", variant, "test") //
.setTimeout(Duration.ofMinutes(2)) //
.setTimeout(TOOL_TIMEOUT) //
.build() //
.run();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@

import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static platform.tooling.support.Helper.TOOL_TIMEOUT;

import java.nio.file.Paths;
import java.time.Duration;

import de.sormuras.bartholdy.Result;
import de.sormuras.bartholdy.tool.GradleWrapper;
Expand Down Expand Up @@ -63,7 +63,7 @@ private Result run(String version) {
.addArguments("build", "--no-daemon", "--stacktrace") //
.addArguments("-Dmaven.repo=" + MavenRepo.dir()) //
.addArguments("-Djunit4Version=" + version) //
.setTimeout(Duration.ofMinutes(2)) //
.setTimeout(TOOL_TIMEOUT) //
.build() //
.run();
assertFalse(result.isTimedOut(), () -> "tool timed out: " + result);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@

import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.jupiter.api.Assertions.assertFalse;

import java.time.Duration;
import static platform.tooling.support.Helper.TOOL_TIMEOUT;

import de.sormuras.bartholdy.Result;

Expand Down Expand Up @@ -63,7 +62,7 @@ private Result run(String version) {
.addArguments("clean", "test", "--debug", "--batch-mode") //
.addArguments("-Dmaven.repo=" + MavenRepo.dir()) //
.addArguments("-Djunit4Version=" + version) //
.setTimeout(Duration.ofMinutes(2)) //
.setTimeout(TOOL_TIMEOUT) //
.build() //
.run();
assertFalse(result.isTimedOut(), () -> "tool timed out: " + result);
Expand Down

0 comments on commit 938ab00

Please sign in to comment.