mirror of
https://github.com/spring-projects/spring-boot.git
synced 2024-08-29 03:06:45 +08:00
Adapt server not running check
The upgrade to the Couchbase SDK v3 changed how errors are reported when the cluster is not available. This commit updates the check to look for the new exception in the hope a more solid check can be found shortly.
This commit is contained in:
parent
58eb0ba4d3
commit
988d650304
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2019 the original author or authors.
|
||||
* Copyright 2012-2020 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@ -15,8 +15,7 @@
|
||||
*/
|
||||
package smoketest.data.couchbase;
|
||||
|
||||
import java.net.ConnectException;
|
||||
|
||||
import com.couchbase.client.core.error.FeatureNotAvailableException;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
|
||||
@ -47,9 +46,10 @@ class SampleCouchbaseApplicationTests {
|
||||
@SuppressWarnings("serial")
|
||||
NestedCheckedException nested = new NestedCheckedException("failed", ex) {
|
||||
};
|
||||
if (nested.contains(ConnectException.class)) {
|
||||
if (nested.contains(FeatureNotAvailableException.class)) {
|
||||
Throwable root = nested.getRootCause();
|
||||
if (root.getMessage().contains("Connection refused")) {
|
||||
// This is not ideal, we should have a better way to know what is going on
|
||||
if (root.getMessage().contains("The cluster does not support cluster-level queries")) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user