Skip to content

Commit 0e4f292

Browse files
authored
[bugfix] fix a broken unit test testCombinedSyncAsyncWait (#106)
* enable logging for testing * Revert "enable logging for testing" This reverts commit f2fafb3. * fix flaky testCombinedSyncAsyncWait case
1 parent b5a80d8 commit 0e4f292

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

sdk/src/test/java/com/amazonaws/lambda/durable/DurableContextTest.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,11 @@ void testCombinedSyncAsyncWait() throws Exception {
145145
var asyncFuture = context.stepAsync("async-step", Integer.class, () -> 42);
146146
assertEquals(42, asyncFuture.get());
147147

148+
// Receiving results from `get` calls doesn't mean the step threads have been deregistered.So we wait for 500ms
149+
// to make sure the above step threads have been deregistered. Otherwise, the wait call will be stuck forever
150+
// and SuspendExecutionException will be thrown from the step thread
151+
Thread.sleep(500);
152+
148153
// Wait should suspend (throw exception)
149154
assertThrows(SuspendExecutionException.class, () -> {
150155
context.wait(Duration.ofSeconds(30));

0 commit comments

Comments
 (0)