Skip to content

Commit d185c4a

Browse files
authored
GEODE-5212: fix timing issues in BeforeCompletionTest (apache#2565)
Signed-off-by: Kirk Lund <[email protected]>
1 parent 9199a9e commit d185c4a

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

geode-core/src/test/java/org/apache/geode/internal/cache/BeforeCompletionTest.java

+6-6
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@
1616

1717
import static org.assertj.core.api.Assertions.assertThat;
1818
import static org.assertj.core.api.Assertions.assertThatThrownBy;
19+
import static org.mockito.Mockito.atLeastOnce;
1920
import static org.mockito.Mockito.doThrow;
2021
import static org.mockito.Mockito.mock;
21-
import static org.mockito.Mockito.times;
2222
import static org.mockito.Mockito.verify;
2323

2424
import java.util.concurrent.TimeUnit;
@@ -81,7 +81,7 @@ public void executeThrowsTransactionExceptionIfDoOpFailedWithRuntimeException()
8181
public void doOpCallsDoBeforeCompletion() {
8282
beforeCompletion.doOp(txState);
8383

84-
verify(txState, times(1)).doBeforeCompletion();
84+
verify(txState).doBeforeCompletion();
8585
}
8686

8787
@Test
@@ -106,17 +106,17 @@ public void executeThrowsIfCancelCriterionThrows() {
106106
}
107107

108108
@Test
109-
public void executeWaitsUntilDoOpFinish() throws Exception {
109+
public void executeWaitsUntilDoOpFinish() {
110110
Thread thread = new Thread(() -> beforeCompletion.execute(cancelCriterion));
111111
thread.start();
112112
// give the thread a chance to get past the "finished" check by waiting until
113113
// checkCancelInProgress is called
114-
Awaitility.await().atMost(60, TimeUnit.SECONDS)
115-
.untilAsserted(() -> verify(cancelCriterion, times(1)).checkCancelInProgress(null));
114+
Awaitility.await().atMost(5, TimeUnit.MINUTES)
115+
.untilAsserted(() -> verify(cancelCriterion, atLeastOnce()).checkCancelInProgress(null));
116116

117117
beforeCompletion.doOp(txState);
118118

119-
Awaitility.await().atMost(60, TimeUnit.SECONDS).until(() -> !(thread.isAlive()));
119+
Awaitility.await().atMost(5, TimeUnit.MINUTES).until(() -> !(thread.isAlive()));
120120
}
121121

122122
}

0 commit comments

Comments
 (0)