Increase tool timeout to reduce flakiness · junit-team/junit-framework@938ab00 (original) (raw)
File tree
- platform-tooling-support-tests/src
- main/java/platform/tooling/support
- test/java/platform/tooling/support/tests
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -15,6 +15,7 @@ | ||
| 15 | 15 | import java.nio.file.Files; |
| 16 | 16 | import java.nio.file.Path; |
| 17 | 17 | import java.nio.file.Paths; |
| 18 | +import java.time.Duration; | |
| 18 | 19 | import java.util.ArrayList; |
| 19 | 20 | import java.util.List; |
| 20 | 21 | import java.util.Objects; |
| @@ -33,6 +34,8 @@ | ||
| 33 | 34 | */ |
| 34 | 35 | public class Helper { |
| 35 | 36 | |
| 37 | +public static final Duration TOOL_TIMEOUT = Duration.ofMinutes(3); | |
| 38 | + | |
| 36 | 39 | private static final Path ROOT = Paths.get(".."); |
| 37 | 40 | private static final Path GRADLE_PROPERTIES = ROOT.resolve("gradle.properties"); |
| 38 | 41 | private static final Path SETTINGS_GRADLE = ROOT.resolve("settings.gradle.kts"); |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -13,8 +13,7 @@ | ||
| 13 | 13 | import static org.junit.jupiter.api.Assertions.assertEquals; |
| 14 | 14 | import static org.junit.jupiter.api.Assertions.assertFalse; |
| 15 | 15 | import static org.junit.jupiter.api.Assertions.assertTrue; |
| 16 | - | |
| 17 | -import java.time.Duration; | |
| 16 | +import static platform.tooling.support.Helper.TOOL_TIMEOUT; | |
| 18 | 17 | |
| 19 | 18 | import de.sormuras.bartholdy.tool.GradleWrapper; |
| 20 | 19 | |
| @@ -37,7 +36,7 @@ void gradle_wrapper() { | ||
| 37 | 36 | .setProject("gradle-kotlin-extensions") // |
| 38 | 37 | .addArguments("-Dmaven.repo=" + MavenRepo.dir()) // |
| 39 | 38 | .addArguments("build", "--no-daemon", "--stacktrace") // |
| 40 | - .setTimeout(Duration.ofMinutes(2)) // | |
| 39 | + .setTimeout(TOOL_TIMEOUT) // | |
| 41 | 40 | .setJavaHome(Helper.getJavaHome("8").orElseThrow(TestAbortedException::new)) // |
| 42 | 41 | .build() // |
| 43 | 42 | .run(); |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -13,9 +13,9 @@ | ||
| 13 | 13 | import static org.junit.jupiter.api.Assertions.assertEquals; |
| 14 | 14 | import static org.junit.jupiter.api.Assertions.assertFalse; |
| 15 | 15 | import static org.junit.jupiter.api.Assertions.assertLinesMatch; |
| 16 | +import static platform.tooling.support.Helper.TOOL_TIMEOUT; | |
| 16 | 17 | |
| 17 | 18 | import java.nio.file.Paths; |
| 18 | -import java.time.Duration; | |
| 19 | 19 | import java.util.List; |
| 20 | 20 | |
| 21 | 21 | import de.sormuras.bartholdy.Tool; |
| @@ -47,7 +47,7 @@ private void test(Tool gradle) { | ||
| 47 | 47 | .addArguments("-Dmaven.repo=" + MavenRepo.dir()) // |
| 48 | 48 | .addArguments("build", "--no-daemon", "--debug", "--stacktrace") // |
| 49 | 49 | .setJavaHome(Helper.getJavaHome("8").orElseThrow(TestAbortedException::new)) // |
| 50 | - .setTimeout(Duration.ofMinutes(2)).build() // | |
| 50 | + .setTimeout(TOOL_TIMEOUT).build() // | |
| 51 | 51 | .run(); |
| 52 | 52 | |
| 53 | 53 | assertFalse(result.isTimedOut(), () -> "tool timed out: " + result); |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -14,9 +14,9 @@ | ||
| 14 | 14 | import static org.junit.jupiter.api.Assertions.assertEquals; |
| 15 | 15 | import static org.junit.jupiter.api.Assertions.assertFalse; |
| 16 | 16 | import static org.junit.jupiter.api.Assertions.assertTrue; |
| 17 | +import static platform.tooling.support.Helper.TOOL_TIMEOUT; | |
| 17 | 18 | |
| 18 | 19 | import java.nio.file.Paths; |
| 19 | -import java.time.Duration; | |
| 20 | 20 | |
| 21 | 21 | import de.sormuras.bartholdy.tool.GradleWrapper; |
| 22 | 22 | |
| @@ -39,7 +39,7 @@ void gradle_wrapper() { | ||
| 39 | 39 | .setProject("gradle-starter") // |
| 40 | 40 | .addArguments("-Dmaven.repo=" + MavenRepo.dir()) // |
| 41 | 41 | .addArguments("build", "--no-daemon", "--stacktrace") // |
| 42 | - .setTimeout(Duration.ofMinutes(2)) // | |
| 42 | + .setTimeout(TOOL_TIMEOUT) // | |
| 43 | 43 | .setJavaHome(Helper.getJavaHome("8").orElseThrow(TestAbortedException::new)) // |
| 44 | 44 | .build() // |
| 45 | 45 | .run(); |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -14,9 +14,9 @@ | ||
| 14 | 14 | import static org.junit.jupiter.api.Assertions.assertFalse; |
| 15 | 15 | import static org.junit.jupiter.api.Assertions.assertTrue; |
| 16 | 16 | import static org.junit.jupiter.api.Assumptions.assumeTrue; |
| 17 | +import static platform.tooling.support.Helper.TOOL_TIMEOUT; | |
| 17 | 18 | |
| 18 | 19 | import java.nio.file.Path; |
| 19 | -import java.time.Duration; | |
| 20 | 20 | import java.util.List; |
| 21 | 21 | |
| 22 | 22 | import de.sormuras.bartholdy.tool.Java; |
| @@ -55,7 +55,7 @@ List execute(String version, Path javaHome) { | ||
| 55 | 55 | .setWorkspace("java-versions-" + version) // |
| 56 | 56 | .addArguments("-Dmaven.repo=" + MavenRepo.dir()) // |
| 57 | 57 | .addArguments("--debug", "--batch-mode", "verify") // |
| 58 | - .setTimeout(Duration.ofMinutes(2)) // | |
| 58 | + .setTimeout(TOOL_TIMEOUT) // | |
| 59 | 59 | .setJavaHome(javaHome) // |
| 60 | 60 | .build().run(); |
| 61 | 61 | assertFalse(result.isTimedOut(), () -> "tool timed out: " + result); |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -14,8 +14,7 @@ | ||
| 14 | 14 | import static org.junit.jupiter.api.Assertions.assertEquals; |
| 15 | 15 | import static org.junit.jupiter.api.Assertions.assertFalse; |
| 16 | 16 | import static org.junit.jupiter.api.Assertions.assertTrue; |
| 17 | - | |
| 18 | -import java.time.Duration; | |
| 17 | +import static platform.tooling.support.Helper.TOOL_TIMEOUT; | |
| 19 | 18 | |
| 20 | 19 | import org.junit.jupiter.api.Test; |
| 21 | 20 | import org.opentest4j.TestAbortedException; |
| @@ -36,7 +35,7 @@ void verifyMavenStarterProject() { | ||
| 36 | 35 | .setProject("maven-starter") // |
| 37 | 36 | .addArguments("-Dmaven.repo=" + MavenRepo.dir()) // |
| 38 | 37 | .addArguments("--debug", "--batch-mode", "verify") // |
| 39 | - .setTimeout(Duration.ofMinutes(2)) // | |
| 38 | + .setTimeout(TOOL_TIMEOUT) // | |
| 40 | 39 | .setJavaHome(Helper.getJavaHome("8").orElseThrow(TestAbortedException::new)) // |
| 41 | 40 | .build() // |
| 42 | 41 | .run(); |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -14,10 +14,10 @@ | ||
| 14 | 14 | import static org.junit.jupiter.api.Assertions.assertFalse; |
| 15 | 15 | import static org.junit.jupiter.api.Assertions.assertLinesMatch; |
| 16 | 16 | import static org.junit.jupiter.api.Assertions.assertTrue; |
| 17 | +import static platform.tooling.support.Helper.TOOL_TIMEOUT; | |
| 17 | 18 | |
| 18 | 19 | import java.nio.file.Files; |
| 19 | 20 | import java.nio.file.Path; |
| 20 | -import java.time.Duration; | |
| 21 | 21 | import java.util.List; |
| 22 | 22 | |
| 23 | 23 | import de.sormuras.bartholdy.Result; |
| @@ -85,7 +85,7 @@ private Result mvn(String variant) { | ||
| 85 | 85 | .setProject("multi-release-jar") // |
| 86 | 86 | .addArguments("-Dmaven.repo=" + MavenRepo.dir()) // |
| 87 | 87 | .addArguments("--show-version", "--errors", "--batch-mode", "--file", variant, "test") // |
| 88 | - .setTimeout(Duration.ofMinutes(2)) // | |
| 88 | + .setTimeout(TOOL_TIMEOUT) // | |
| 89 | 89 | .build() // |
| 90 | 90 | .run(); |
| 91 | 91 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -12,9 +12,9 @@ | ||
| 12 | 12 | |
| 13 | 13 | import static org.assertj.core.api.Assertions.assertThat; |
| 14 | 14 | import static org.junit.jupiter.api.Assertions.assertFalse; |
| 15 | +import static platform.tooling.support.Helper.TOOL_TIMEOUT; | |
| 15 | 16 | |
| 16 | 17 | import java.nio.file.Paths; |
| 17 | -import java.time.Duration; | |
| 18 | 18 | |
| 19 | 19 | import de.sormuras.bartholdy.Result; |
| 20 | 20 | import de.sormuras.bartholdy.tool.GradleWrapper; |
| @@ -63,7 +63,7 @@ private Result run(String version) { | ||
| 63 | 63 | .addArguments("build", "--no-daemon", "--stacktrace") // |
| 64 | 64 | .addArguments("-Dmaven.repo=" + MavenRepo.dir()) // |
| 65 | 65 | .addArguments("-Djunit4Version=" + version) // |
| 66 | - .setTimeout(Duration.ofMinutes(2)) // | |
| 66 | + .setTimeout(TOOL_TIMEOUT) // | |
| 67 | 67 | .build() // |
| 68 | 68 | .run(); |
| 69 | 69 | assertFalse(result.isTimedOut(), () -> "tool timed out: " + result); |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -12,8 +12,7 @@ | ||
| 12 | 12 | |
| 13 | 13 | import static org.assertj.core.api.Assertions.assertThat; |
| 14 | 14 | import static org.junit.jupiter.api.Assertions.assertFalse; |
| 15 | - | |
| 16 | -import java.time.Duration; | |
| 15 | +import static platform.tooling.support.Helper.TOOL_TIMEOUT; | |
| 17 | 16 | |
| 18 | 17 | import de.sormuras.bartholdy.Result; |
| 19 | 18 | |
| @@ -63,7 +62,7 @@ private Result run(String version) { | ||
| 63 | 62 | .addArguments("clean", "test", "--debug", "--batch-mode") // |
| 64 | 63 | .addArguments("-Dmaven.repo=" + MavenRepo.dir()) // |
| 65 | 64 | .addArguments("-Djunit4Version=" + version) // |
| 66 | - .setTimeout(Duration.ofMinutes(2)) // | |
| 65 | + .setTimeout(TOOL_TIMEOUT) // | |
| 67 | 66 | .build() // |
| 68 | 67 | .run(); |
| 69 | 68 | assertFalse(result.isTimedOut(), () -> "tool timed out: " + result); |