I have some Springboot integration tests which worked fine in Springboot 2.1 but now that I have upgraded to Springboot 2.2 they're failing. Using default spring-boot parent dependency management. Some failing tests which used to work are as simple as this example:
...
@RunWith(SpringRunner.class)
@SpringBootTest(
webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT,
properties = {"spring.sleuth.enabled=false"})
@Import({AccountApiClient.class,...})
@DirtiesContext
@AutoConfigureStubRunner(stubsMode = StubRunnerProperties.StubsMode.CLASSPATH,
ids = {"my.org.com:account-service:+:stubs:9021"},
consumerName = "AccountServiceV2",
stubsPerConsumer = true)
public class AccountsClientTest {
@Autowired
AccountService accountService;
@Test
public void verifyAccountsShouldReturnEmpty() {
Mono<List<Accounts>> acc = accountService.getAccounts(new AccountId(ACC_ID));
assertThat(acc.block(), hasSize(0));
}
...
Before the upgrade, this test passes as expected but after the upgrade, it fails with the following error:
[ERROR] verifyAccountsShouldReturnEmpty Time elapsed: 0.004 s <<< ERROR!
reactor.core.Exceptions$ReactiveException: java.lang.AssertionError: Spring Context [org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext@7d605944, started on Tue Aug 18 10:00:09 CEST 2020, parent: org.springframework.context.annotation.AnnotationConfigApplicationContext@a035db9] is not yet refreshed. This is unexpected. Reactor Context is [Context0{}] and name is [blocking]
I have many tests with similar behaviour after upgrading and have been stuck with this issue for a few hours already. It fails on line assertThat(acc.block(), hasSize(0));
Any ideas on what's causing it and how to fix would be greatly appreciated.
Thanks.
Aucun commentaire:
Enregistrer un commentaire