Attempt to work around couchbase CI failures
This commit is contained in:
parent
88f3fa4f78
commit
4167469781
|
@ -19,7 +19,7 @@ package org.springframework.boot.autoconfigure.couchbase;
|
|||
import org.junit.After;
|
||||
|
||||
import org.springframework.boot.autoconfigure.PropertyPlaceholderAutoConfiguration;
|
||||
import org.springframework.boot.test.EnvironmentTestUtils;
|
||||
import org.springframework.boot.test.util.EnvironmentTestUtils;
|
||||
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
|
||||
|
||||
/**
|
||||
|
|
|
@ -30,6 +30,8 @@ import org.junit.rules.TestRule;
|
|||
import org.junit.runner.Description;
|
||||
import org.junit.runners.model.Statement;
|
||||
|
||||
import org.springframework.beans.factory.BeanCreationException;
|
||||
|
||||
/**
|
||||
* {@link TestRule} for working with an optional Couchbase server. Expects a default
|
||||
* {@link Bucket} with no password to be available on localhost.
|
||||
|
@ -48,8 +50,7 @@ public class CouchbaseTestServer implements TestRule {
|
|||
public Statement apply(Statement base, Description description) {
|
||||
try {
|
||||
this.environment = DefaultCouchbaseEnvironment.create();
|
||||
this.cluster = CouchbaseCluster.create(this.environment,
|
||||
"localhost");
|
||||
this.cluster = CouchbaseCluster.create(this.environment, "localhost");
|
||||
testConnection(this.cluster);
|
||||
return new CouchbaseStatement(base, this.environment, this.cluster);
|
||||
}
|
||||
|
@ -98,6 +99,13 @@ public class CouchbaseTestServer implements TestRule {
|
|||
try {
|
||||
this.base.evaluate();
|
||||
}
|
||||
catch (BeanCreationException ex) {
|
||||
if ("couchbaseClient".equals(ex.getBeanName())) {
|
||||
throw new AssumptionViolatedException(
|
||||
"Skipping test due to Couchbase error " + ex.getMessage(),
|
||||
ex);
|
||||
}
|
||||
}
|
||||
finally {
|
||||
try {
|
||||
this.cluster.disconnect();
|
||||
|
|
Loading…
Reference in New Issue