Commit 41674697 authored by Phillip Webb's avatar Phillip Webb

Attempt to work around couchbase CI failures

parent 88f3fa4f
......@@ -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();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment