Skip to content

Commit d4c6c55

Browse files
authored
bug(#767): add explicit timeouts to slow tests to prevent CI failures (#768)
1 parent e751958 commit d4c6c55

File tree

3 files changed

+12
-2
lines changed

3 files changed

+12
-2
lines changed

src/test/groovy/org/eolang/lints/HomeNamesTest.groovy

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ package org.eolang.lints
77
import com.yegor256.MayBeSlow
88
import java.nio.file.Path
99
import java.nio.file.Paths
10+
import java.util.concurrent.TimeUnit
1011
import org.hamcrest.MatcherAssert
1112
import org.hamcrest.Matchers
1213
import org.junit.jupiter.api.Tag
@@ -24,6 +25,7 @@ import org.junit.jupiter.api.io.TempDir
2425
@ExtendWith(MayBeSlow)
2526
final class HomeNamesTest {
2627

28+
@Timeout(unit = TimeUnit.MINUTES, value = 3L)
2729
@Test
2830
void placesHomeObjectsAsReserved(@TempDir final Path temp) {
2931
final String csv = temp.resolve("reserved.csv").toString()
@@ -35,6 +37,7 @@ final class HomeNamesTest {
3537
)
3638
}
3739

40+
@Timeout(unit = TimeUnit.MINUTES, value = 3L)
3841
@Test
3942
void placesHomeObjectsWithCorrectNames(@TempDir final Path temp) {
4043
final String csv = temp.resolve("reserved.csv").toString()

src/test/java/org/eolang/lints/LtByXslTest.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
import java.util.HashSet;
1919
import java.util.Map;
2020
import java.util.Set;
21+
import java.util.concurrent.TimeUnit;
2122
import java.util.function.Function;
2223
import java.util.function.Predicate;
2324
import java.util.stream.Collectors;
@@ -359,7 +360,7 @@ void doesNotDuplicateDefectsWhenMultipleDefectsOnTheSameLine() throws Exception
359360

360361
@SuppressWarnings("StreamResourceLeak")
361362
@Tag("deep")
362-
@Timeout(180L)
363+
@Timeout(unit = TimeUnit.MINUTES, value = 5L)
363364
@Test
364365
void validatesEoPacksForErrors() throws IOException {
365366
Files.walk(Paths.get("src/test/resources/org/eolang/lints/packs/single"))

src/test/java/org/eolang/lints/SourceTest.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
import java.util.HashSet;
2929
import java.util.List;
3030
import java.util.Map;
31+
import java.util.concurrent.TimeUnit;
3132
import java.util.regex.Pattern;
3233
import java.util.stream.Collectors;
3334
import org.cactoos.bytes.BytesOf;
@@ -61,12 +62,17 @@
6162
* Test for {@link Source}.
6263
*
6364
* @since 0.0.1
65+
* @todo #767:60min Decrease timeouts for source linting.
66+
* As for now, most lints are too slow, we need to optimize them first, so they
67+
* run in milliseconds, not seconds/minutes. It should decrease our build time too.
68+
* After that, we need to decrease our test timeouts. Don't forget to remove this puzzle.
6469
* @checkstyle MethodBodyCommentsCheck (50 lines)
6570
*/
6671
@SuppressWarnings("PMD.TooManyMethods")
6772
@ExtendWith(MktmpResolver.class)
6873
final class SourceTest {
6974

75+
@Timeout(unit = TimeUnit.SECONDS, value = 60L)
7076
@Test
7177
void returnsEmptyListOfDefects() throws IOException {
7278
MatcherAssert.assertThat(
@@ -144,7 +150,7 @@ void checksSimple(@Mktmp final Path dir) throws IOException {
144150
}
145151

146152
@Tag("deep")
147-
@Timeout(60L)
153+
@Timeout(unit = TimeUnit.MINUTES, value = 2L)
148154
@RepeatedTest(2)
149155
void lintsInMultipleThreads() {
150156
MatcherAssert.assertThat(

0 commit comments

Comments
 (0)