我们正在为我们的数据库创建集成Spring Boot 2.1.7.RELEASE测试Couchbase。
我们正在使用测试容器,当测试运行完成时,我们收到此错误:
java.util.concurrent.RejectedExecutionException:任务 java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask@da0432 被 java.util.concurrent.ScheduledThreadPoolExecutor@238be2 拒绝[已终止,池大小 = 0,活动线程 = 0,排队任务 = 0,已完成任务= 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{
@ClassRule
public 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());
@BeforeClass
public static void beforeClass() throws IOException{
log.debug("Starting containers...");
couchbaseContainer.start();
}
@AfterClass
public static void afterClass(){
log.debug("Stopping containers...");
couchbaseContainer.stop();
}
繁星coding
四季花海
相关分类