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]


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();
}

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM