Skip to content

Commit

Permalink
Revert "Add MonoFirstWithValue inflight cancellation test (#3915)" (#…
Browse files Browse the repository at this point in the history
…3934)

This reverts commit 3ba3cc1.
  • Loading branch information
chemicL authored Nov 12, 2024
1 parent 0b4f036 commit 789ed7e
Showing 1 changed file with 0 additions and 32 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,11 @@
import java.util.Arrays;
import java.util.List;
import java.util.NoSuchElementException;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.atomic.AtomicLong;

import org.junit.jupiter.api.Test;

import reactor.core.Exceptions;
import reactor.core.Scannable;
import reactor.core.scheduler.Schedulers;
import reactor.test.StepVerifier;
import reactor.test.publisher.TestPublisher;
import reactor.test.subscriber.AssertSubscriber;
Expand Down Expand Up @@ -175,35 +172,6 @@ void cancelIsPropagated() {
pub2.assertMaxRequested(1);
pub2.assertWasCancelled();
}
@Test
void cancelInflightMono() {
AtomicLong cancelledInflightMonos = new AtomicLong(0);
CountDownLatch inflightMonoLatch = new CountDownLatch(1);
CountDownLatch completedMonoLatch = new CountDownLatch(1);
Mono<Integer> inflightMono1 = Mono.fromCallable(() -> {
inflightMonoLatch.await();
return 1;
}).doOnCancel(cancelledInflightMonos::getAndIncrement).subscribeOn(Schedulers.boundedElastic());

Mono<Integer> inflightMono2 = Mono.fromCallable(() -> {
inflightMonoLatch.await();
return 2;
}).doOnCancel(cancelledInflightMonos::getAndIncrement).subscribeOn(Schedulers.boundedElastic());

Mono<Integer> completedMono = Mono.fromCallable(() -> {
completedMonoLatch.await();
return 3;
}).doOnCancel(cancelledInflightMonos::getAndIncrement).subscribeOn(Schedulers.boundedElastic());

StepVerifier.create(Mono.firstWithValue(inflightMono1, inflightMono2, completedMono))
.then(() -> {
completedMonoLatch.countDown();
})
.expectNext(3)
.verifyComplete();

assertThat(cancelledInflightMonos).hasValue(2);
}

@Test
void singleArrayNullSource() {
Expand Down

0 comments on commit 789ed7e

Please sign in to comment.