Increase the likelihood that timed tests pass on CI server

This commit is contained in:
Sam Brannen 2021-05-11 16:16:18 +02:00
parent 60c551a95b
commit cd9cad31f9
2 changed files with 11 additions and 11 deletions

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2020 the original author or authors. * Copyright 2002-2021 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -67,7 +67,7 @@ class TimedTransactionalSpringExtensionTests {
event(test("WithExceededJUnitJupiterTimeout"), event(test("WithExceededJUnitJupiterTimeout"),
finishedWithFailure( finishedWithFailure(
instanceOf(TimeoutException.class), instanceOf(TimeoutException.class),
message(msg -> msg.endsWith("timed out after 50 milliseconds"))))); message(msg -> msg.endsWith("timed out after 10 milliseconds")))));
} }
@ -83,10 +83,10 @@ class TimedTransactionalSpringExtensionTests {
} }
@Test @Test
@Timeout(value = 50, unit = TimeUnit.MILLISECONDS) @Timeout(value = 10, unit = TimeUnit.MILLISECONDS)
void transactionalWithExceededJUnitJupiterTimeout() throws Exception { void transactionalWithExceededJUnitJupiterTimeout() throws Exception {
assertThatTransaction().isActive(); assertThatTransaction().isActive();
Thread.sleep(100); Thread.sleep(200);
} }
@Test @Test
@ -97,11 +97,11 @@ class TimedTransactionalSpringExtensionTests {
} }
@Test @Test
@Timeout(value = 50, unit = TimeUnit.MILLISECONDS) @Timeout(value = 10, unit = TimeUnit.MILLISECONDS)
@Transactional(propagation = Propagation.NOT_SUPPORTED) @Transactional(propagation = Propagation.NOT_SUPPORTED)
void notTransactionalWithExceededJUnitJupiterTimeout() throws Exception { void notTransactionalWithExceededJUnitJupiterTimeout() throws Exception {
assertThatTransaction().isNotActive(); assertThatTransaction().isNotActive();
Thread.sleep(100); Thread.sleep(200);
} }

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2019 the original author or authors. * Copyright 2002-2021 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -76,14 +76,14 @@ public class TimedSpringRunnerTests {
} }
// Should Fail due to timeout. // Should Fail due to timeout.
@Test(timeout = 100) @Test(timeout = 10)
public void jUnitTimeoutWithSleep() throws Exception { public void jUnitTimeoutWithSleep() throws Exception {
Thread.sleep(200); Thread.sleep(200);
} }
// Should Fail due to timeout. // Should Fail due to timeout.
@Test @Test
@Timed(millis = 100) @Timed(millis = 10)
public void springTimeoutWithSleep() throws Exception { public void springTimeoutWithSleep() throws Exception {
Thread.sleep(200); Thread.sleep(200);
} }
@ -97,7 +97,7 @@ public class TimedSpringRunnerTests {
// Should Fail due to timeout. // Should Fail due to timeout.
@Test @Test
@MetaTimedWithOverride(millis = 100) @MetaTimedWithOverride(millis = 10)
public void springTimeoutWithSleepAndMetaAnnotationAndOverride() throws Exception { public void springTimeoutWithSleepAndMetaAnnotationAndOverride() throws Exception {
Thread.sleep(200); Thread.sleep(200);
} }
@ -110,7 +110,7 @@ public class TimedSpringRunnerTests {
} }
} }
@Timed(millis = 100) @Timed(millis = 10)
@Retention(RetentionPolicy.RUNTIME) @Retention(RetentionPolicy.RUNTIME)
private static @interface MetaTimed { private static @interface MetaTimed {
} }