org.h2.jdbc.jdbcsqlexception: database is already closed (to disable automatic closing at vm shutdown, add ";db_close_on_exit=false" to the db url) [90121-197]

在集成测试的时候遇到这个问题,后来发现,测试代码采用异步调用,而被测试的接口是同步的,这样就会导致超时。最好不要用这种方式,但是没办法,要统一改的话,工作量会比较大,而且任务比较紧,一个偷懒的办法就是,将超时时间设置的长一些,
在集成测试项目文件中添加如下代码

@Autowired
protected WebTestClient http;

/**
* 设置超时时间.
*/
@Before
public void setUp() {
http = http
.mutate()
.responseTimeout(Duration.ofMillis(100000))
.build();
}

 

相关文章:

  • 2021-06-15
  • 2022-02-25
  • 2022-12-23
  • 2021-10-04
  • 2022-02-24
  • 2021-07-31
  • 2021-12-05
  • 2021-08-03
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-09-02
  • 2021-06-14
  • 2021-10-25
  • 2021-05-20
  • 2021-06-17
相关资源
相似解决方案