Skip to content

Commit

Permalink
Increase the likelihood that timed tests pass on CI server
Browse files Browse the repository at this point in the history
  • Loading branch information
sbrannen committed May 11, 2021
1 parent 60c551a commit cd9cad3
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
Original file line number Diff line number Diff line change
@@ -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");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -67,7 +67,7 @@ void springTransactionsWorkWithJUnitJupiterTimeouts() {
event(test("WithExceededJUnitJupiterTimeout"),
finishedWithFailure(
instanceOf(TimeoutException.class),
message(msg -> msg.endsWith("timed out after 50 milliseconds")))));
message(msg -> msg.endsWith("timed out after 10 milliseconds")))));
}


Expand All @@ -83,10 +83,10 @@ void transactionalWithJUnitJupiterTimeout() {
}

@Test
@Timeout(value = 50, unit = TimeUnit.MILLISECONDS)
@Timeout(value = 10, unit = TimeUnit.MILLISECONDS)
void transactionalWithExceededJUnitJupiterTimeout() throws Exception {
assertThatTransaction().isActive();
Thread.sleep(100);
Thread.sleep(200);
}

@Test
Expand All @@ -97,11 +97,11 @@ void notTransactionalWithJUnitJupiterTimeout() {
}

@Test
@Timeout(value = 50, unit = TimeUnit.MILLISECONDS)
@Timeout(value = 10, unit = TimeUnit.MILLISECONDS)
@Transactional(propagation = Propagation.NOT_SUPPORTED)
void notTransactionalWithExceededJUnitJupiterTimeout() throws Exception {
assertThatTransaction().isNotActive();
Thread.sleep(100);
Thread.sleep(200);
}


Expand Down
Original file line number Diff line number Diff line change
@@ -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");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -76,14 +76,14 @@ public void springTimeoutWithNoOp() {
}

// Should Fail due to timeout.
@Test(timeout = 100)
@Test(timeout = 10)
public void jUnitTimeoutWithSleep() throws Exception {
Thread.sleep(200);
}

// Should Fail due to timeout.
@Test
@Timed(millis = 100)
@Timed(millis = 10)
public void springTimeoutWithSleep() throws Exception {
Thread.sleep(200);
}
Expand All @@ -97,7 +97,7 @@ public void springTimeoutWithSleepAndMetaAnnotation() throws Exception {

// Should Fail due to timeout.
@Test
@MetaTimedWithOverride(millis = 100)
@MetaTimedWithOverride(millis = 10)
public void springTimeoutWithSleepAndMetaAnnotationAndOverride() throws Exception {
Thread.sleep(200);
}
Expand All @@ -110,7 +110,7 @@ public void springAndJUnitTimeouts() {
}
}

@Timed(millis = 100)
@Timed(millis = 10)
@Retention(RetentionPolicy.RUNTIME)
private static @interface MetaTimed {
}
Expand Down

0 comments on commit cd9cad3

Please sign in to comment.