在使用couchbase/server:latest
docker image with environment。
CouchbaseEnvironment couchbaseEnvironment = DefaultCouchbaseEnvironment.builder()
.bootstrapCarrierDirectPort(getMappedPort(11210))
.bootstrapCarrierSslPort(getMappedPort(11207))
.bootstrapHttpDirectPort(getMappedPort(8091))
.bootstrapHttpSslPort(getMappedPort(18091))
.build();
gradle中的依赖
testCompile group: 'org.testcontainers', name: 'testcontainers', version: '1.5.1'
testCompile group: 'com.couchbase.client', name: 'java-client', version: '2.5.7'
运行测试时会出现以下错误。
Caused by: com.couchbase.client.core.CouchbaseException: Could not insert bucket: {"errors":{"proxyPort":"The port number must be greater than 1023 and less than 65536."},"summaries":{"ramSummary":{"total":419430400,"otherBuckets":0,"nodesCount":1,"perNodeMegs":100,"thisAlloc":104857600,"thisUsed":0,"free":314572800},"hddSummary":{"total":67371577344,"otherData":22906336296,"otherBuckets":0,"thisUsed":0,"free":44465241048}}}