Timeout on blocking read for 5000 MILLISECONDS in Spring WEBLUX

后端 未结 2 1346
一整个雨季
一整个雨季 2020-12-31 07:36

i wrote a test for Handler (spring weblux)

test:

@Test
    public void checkServicesHandlerTest(){
      Request request = new Request();
        req         


        
相关标签:
2条回答
  • 2020-12-31 08:22

    You can override the timeout by using the annotation @AutoConfigureWebTestClient(timeout = "36000").

    for example :

    @AutoConfigureWebTestClient(timeout = "36000")
    @SpringBootTest
    class MyTestClass {
    }
    
    0 讨论(0)
  • 2020-12-31 08:26

    I was seeing similar issue and Exception when running Integration tests some of them aggregates responses from multiple other services which has database access and stuff. So we were seeing this issue intermittently when running Integration tests. We are using Spring Boot 2.0.0.RC1 and Junit 5 with Gradle. I did this to resolve the issue. The key is mutating the webclient with a response timeout of 30 seconds the worst case.

        @Autowired
        private WebTestClient webTestClient;
    
            @BeforeEach
            public void setUp() {
             webTestClient = webTestClient
                                .mutate()
                                .responseTimeout(Duration.ofMillis(30000))
                                .build();
            }
    
    0 讨论(0)
提交回复
热议问题