Skip to content

Commit

Permalink
Merge pull request #1535 from jponge/test/flaky-UniCreateFromFutureTest
Browse files Browse the repository at this point in the history
test(UniCreateFromFutureTest): fix a flaky test in slow CI conditions
  • Loading branch information
jponge authored Mar 4, 2024
2 parents 316b95c + ca766b5 commit 43425d2
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package io.smallrye.mutiny.operators;

import static org.assertj.core.api.Assertions.assertThat;
import static org.awaitility.Awaitility.await;
import static org.junit.jupiter.api.Assertions.assertThrows;

import java.io.IOException;
Expand Down Expand Up @@ -106,10 +107,13 @@ public void testWithException() {
@Test
public void testWithTimeoutException() throws InterruptedException {
UniAssertSubscriber<String> subscriber = UniAssertSubscriber.create();
AtomicBoolean step = new AtomicBoolean();
CompletableFuture<String> cs = new CompletableFuture<>();
Uni.createFrom().future(cs, Duration.ofMillis(1)).subscribe().withSubscriber(subscriber);
Uni.createFrom().future(cs, Duration.ofMillis(1))
.onFailure().invoke(() -> step.set(true))
.subscribe().withSubscriber(subscriber);
// synthetic delay
Thread.sleep(50);
await().untilTrue(step);
cs.complete("1");
subscriber
.awaitFailure()
Expand Down

0 comments on commit 43425d2

Please sign in to comment.