Skip to content

Commit cd9cad3

Browse files
committed
Increase the likelihood that timed tests pass on CI server
1 parent 60c551a commit cd9cad3

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

spring-test/src/test/java/org/springframework/test/context/junit/jupiter/transaction/TimedTransactionalSpringExtensionTests.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2020 the original author or authors.
2+
* Copyright 2002-2021 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -67,7 +67,7 @@ void springTransactionsWorkWithJUnitJupiterTimeouts() {
6767
event(test("WithExceededJUnitJupiterTimeout"),
6868
finishedWithFailure(
6969
instanceOf(TimeoutException.class),
70-
message(msg -> msg.endsWith("timed out after 50 milliseconds")))));
70+
message(msg -> msg.endsWith("timed out after 10 milliseconds")))));
7171
}
7272

7373

@@ -83,10 +83,10 @@ void transactionalWithJUnitJupiterTimeout() {
8383
}
8484

8585
@Test
86-
@Timeout(value = 50, unit = TimeUnit.MILLISECONDS)
86+
@Timeout(value = 10, unit = TimeUnit.MILLISECONDS)
8787
void transactionalWithExceededJUnitJupiterTimeout() throws Exception {
8888
assertThatTransaction().isActive();
89-
Thread.sleep(100);
89+
Thread.sleep(200);
9090
}
9191

9292
@Test
@@ -97,11 +97,11 @@ void notTransactionalWithJUnitJupiterTimeout() {
9797
}
9898

9999
@Test
100-
@Timeout(value = 50, unit = TimeUnit.MILLISECONDS)
100+
@Timeout(value = 10, unit = TimeUnit.MILLISECONDS)
101101
@Transactional(propagation = Propagation.NOT_SUPPORTED)
102102
void notTransactionalWithExceededJUnitJupiterTimeout() throws Exception {
103103
assertThatTransaction().isNotActive();
104-
Thread.sleep(100);
104+
Thread.sleep(200);
105105
}
106106

107107

spring-test/src/test/java/org/springframework/test/context/junit4/TimedSpringRunnerTests.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2019 the original author or authors.
2+
* Copyright 2002-2021 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -76,14 +76,14 @@ public void springTimeoutWithNoOp() {
7676
}
7777

7878
// Should Fail due to timeout.
79-
@Test(timeout = 100)
79+
@Test(timeout = 10)
8080
public void jUnitTimeoutWithSleep() throws Exception {
8181
Thread.sleep(200);
8282
}
8383

8484
// Should Fail due to timeout.
8585
@Test
86-
@Timed(millis = 100)
86+
@Timed(millis = 10)
8787
public void springTimeoutWithSleep() throws Exception {
8888
Thread.sleep(200);
8989
}
@@ -97,7 +97,7 @@ public void springTimeoutWithSleepAndMetaAnnotation() throws Exception {
9797

9898
// Should Fail due to timeout.
9999
@Test
100-
@MetaTimedWithOverride(millis = 100)
100+
@MetaTimedWithOverride(millis = 10)
101101
public void springTimeoutWithSleepAndMetaAnnotationAndOverride() throws Exception {
102102
Thread.sleep(200);
103103
}
@@ -110,7 +110,7 @@ public void springAndJUnitTimeouts() {
110110
}
111111
}
112112

113-
@Timed(millis = 100)
113+
@Timed(millis = 10)
114114
@Retention(RetentionPolicy.RUNTIME)
115115
private static @interface MetaTimed {
116116
}

0 commit comments

Comments
 (0)