第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機(jī)立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

TestContainers、Couchbase 和 Spring Boot -

TestContainers、Couchbase 和 Spring Boot -

哈士奇WWW 2023-08-16 17:40:38
我們正在為我們的數(shù)據(jù)庫創(chuàng)建集成Spring Boot 2.1.7.RELEASE測試Couchbase。我們正在使用測試容器,當(dāng)測試運行完成時,我們收到此錯誤:java.util.concurrent.RejectedExecutionException:任務(wù) java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask@da0432 被 java.util.concurrent.ScheduledThreadPoolExecutor@238be2 拒絕[已終止,池大小 = 0,活動線程 = 0,排隊任務(wù) = 0,已完成任務(wù)= 0]在我們的 pom 中:  <dependency>        <groupId>org.testcontainers</groupId>        <artifactId>couchbase</artifactId>        <version>1.12.1</version>        <scope>test</scope>    </dependency>    <dependency>        <groupId>org.testcontainers</groupId>        <artifactId>testcontainers</artifactId>        <version>1.12.1</version>        <scope>test</scope>    </dependency>在我們的“集成測試配置”類中:@RunWith(SpringRunner.class)@SpringBootTest(classes = {MyApplication.class, IntegrationTestConfig.CouchbaseTestConfig.class},    webEnvironment = SpringBootTest.WebEnvironment.DEFINED_PORT)public abstract class IntegrationTestConfig{@ClassRulepublic static CouchbaseContainer couchbaseContainer = new CouchbaseContainer()        .withIndex(true)        .withQuery(true)        .withClusterAdmin("clusterUser", "clusterPassword")        .withNewBucket(DefaultBucketSettings.builder()                .enableFlush(true)                .name("bucketName")                .password("bucketPassword")                .quota(100)                .replicas(0)                .type(BucketType.COUCHBASE)                .build());@BeforeClasspublic static void beforeClass() throws IOException{    log.debug("Starting containers...");    couchbaseContainer.start();}@AfterClasspublic static void afterClass(){    log.debug("Stopping containers...");    couchbaseContainer.stop();}
查看完整描述

2 回答

?
繁星coding

TA貢獻(xiàn)1797條經(jīng)驗 獲得超4個贊

您可能需要在守護(hù)程序模式下運行數(shù)據(jù)庫,這樣它就不會自動停止

查看完整回答
反對 回復(fù) 2023-08-16
?
四季花海

TA貢獻(xiàn)1811條經(jīng)驗 獲得超5個贊

因此,在這方面浪費了兩天令人沮喪的時間后,事實證明問題出在以下函數(shù)上:


@AfterClass

public static void afterClass(){

  log.debug("Stopping containers...");

  couchbaseContainer.stop();

}

只需刪除對


couchbaseContainer.stop();

解決了問題。


看起來,即使正在afterClass停止Couchbase容器,其他東西也在嘗試停止它,如堆棧跟蹤中所示:


at org.testcontainers.couchbase.CouchbaseContainer.stopCluster(CouchbaseContainer.java:198)

at org.testcontainers.couchbase.CouchbaseContainer.stop(CouchbaseContainer.java:193)

stop()所以實際上解決方案是從其中刪除afterClass并讓其他東西停止容器。


查看完整回答
反對 回復(fù) 2023-08-16
  • 2 回答
  • 0 關(guān)注
  • 156 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號