title: Spring integration testing with Schedulers.elastic
body: <p>I have the following spring reactor code that does saving in DB through Schedulers.elastic(). However I see the elastic thread does not end / commit until 60 seconds elapses(its idle time). So my integration test are failing unless I wait for that time. Is there a better way to do this ? like using  Schedulers.immediate() for tests and elastic for actual deployment.</p>
  
  <pre><code>public void method() {
     Mono.just(student)
     .flatMap(student -&gt; populateStudentDetails(student))
     .subscribeOn(Schedulers.elastic)
     .subscribe(studentRepository::save);
  }
  </code></pre>
  
  <p>I am running my test as below</p>
  
  <pre><code>@SpringBootTest
  public class TestClass {
     @Test
     void testMethod() {
          testClass.method();
          //assertForDatainDB
          //fails if immediately asserted
          //succeeds if asserted after 60s
     }
  }
  </code></pre>