WireMock正在超时

问题描述

我正在使用Wiremock来运行我的测试用例,它在HTTP调用上由于超时而失败。如果我增加时间,它可以正常工作。下面是我正在使用的代码。

@SpringBootTest
@ActiveProfiles("dev")
@TestInstance(TestInstance.Lifecycle.PER_CLASS)
@AutoConfigureWireMock(port=0)
class BaseIT {
<<<Some common things for all calls >>>
}

class MyServiceIT : BaseIT() {
     @Test
        fun `without travel ads returns sorted organic properties`() {
            <<<< some  code >>>
            stubFor(post(urlEqualTo("/myApi"))
                    .willReturn(WireMock.aResponse()
                            .withHeader("Content-Type","application/x-protobuf")
                            .withBody(stubResponse.toByteArray())));

            val actualResponse = runBlocking {
                myService.getUserData()
            }
            
            <<< Some assertions >>
        }
}

我认为问题是因为在代码中发生真正的调用之前,wiremock存根还没有准备好。有没有办法在进行实际呼叫之前确保电线模拟存根已经准备好?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...