reactor / reactor-core

Non-Blocking Reactive Foundation for the JVM

Home Page:http://projectreactor.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

BoundedElasticThreadPerTaskSchedulerTest > ensuresTasksScheduling() FAILED

chemicL opened this issue · comments

BoundedElasticThreadPerTaskSchedulerTest > ensuresTasksScheduling() FAILED
    org.opentest4j.AssertionFailedError: 
    Expecting value to be true but was false
        at jdk.internal.reflect.DirectConstructorHandleAccessor.newInstance(DirectConstructorHandleAccessor.java:62)
        at java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:502)
        at reactor.core.scheduler.BoundedElasticThreadPerTaskSchedulerTest.ensuresTasksScheduling(BoundedElasticThreadPerTaskSchedulerTest.java:78)
  • Reactor version(s) used: 3.6.4
  • JVM version (java -version): Java_Temurin-Hotspot_jdk/21.0.2-13/x64
  • OS and version (eg uname -a): Ubuntu 22.0 LTS
	@Test
	public void ensuresTasksScheduling() throws InterruptedException {
		CountDownLatch latch = new CountDownLatch(1);

		Disposable disposable = scheduler.schedule(latch::countDown);

		Assertions.assertThat(latch.await(5, TimeUnit.SECONDS)).isTrue();

                // AS-IS
		Assertions.assertThat(disposable.isDisposed()).isTrue();
                // TO-BE
		await().untilAsserted(() -> disposable.isDisposed()).isTrue());
	}

Hmm how about using await().untilAsserted(..) to check disposable.isDisposed()).isTrue()?

Cause disposable.dispose() is not finished yet right after latch reaches zero!

That sounds correct. Are you interested in a contribution?

Sure! I'll create PR within this weekend. thank you! :)

#3779 my friend who really loves opensource create fix PR! PTAL 🙇