Closed FeanorsCurse closed 1 year ago
We can't really provide 1:1 support, please continue further discussion on a site like stackoverflow.
This is probably unsafe, so I'd start by using different MockWebServer instances per test.
protected static MockWebServer mockWebServer;
@BeforeAll
public static void startMockServer() {
try {
mockWebServer = new MockWebServer();
mockWebServer.start();
System.out.println("### mockserver: " + mockWebServer.url("/").toString());
System.setProperty("feign.baseUrl", mockWebServer.url("/").toString());
} catch (Exception e) {
throw new RuntimeException(e);
}
}
@AfterAll
public static void stopMockServer() {
try {
mockWebServer.shutdown();
} catch (IOException e) {
throw new RuntimeException(e);
}
}
Thanks for the quick reply. As adviced, I tried with @BeforeEach as well, makes no difference.
Hi,
Tests work individually but not when both are run. Exception in this case is:
Request processing failed; nested exception is feign.RetryableException: localhost:51483 failed to respond executing POST http://localhost:51483/feigntest; nested exception is org.springframework.web.util.NestedServletException: Request processing failed; nested exception is feign.RetryableException: localhost:51483 failed to respond executing POST http://localhost:51483/feigntest org.springframework.web.reactive.function.client.WebClientRequestException: Request processing failed; nested exception is feign.RetryableException: localhost:51483 failed to respond executing POST http://localhost:51483/feigntest; nested exception is org.springframework.web.util.NestedServletException: Request processing failed; nested exception is feign.RetryableException: localhost:51483 failed to respond executing POST http://localhost:51483/feigntest
Minimal (Spring Boot) project can be downloaded here.
BR, Daniel