Commit 988d6503 authored by Stephane Nicoll's avatar Stephane Nicoll

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.
parent 58eb0ba4
/*
* 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;
}
}
......
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