From 988d65030464a8e93e49df70a1053e2aa6e5f80b Mon Sep 17 00:00:00 2001 From: Stephane Nicoll Date: Tue, 17 Mar 2020 17:55:57 +0100 Subject: [PATCH] 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. --- .../couchbase/SampleCouchbaseApplicationTests.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-data-couchbase/src/test/java/smoketest/data/couchbase/SampleCouchbaseApplicationTests.java b/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-data-couchbase/src/test/java/smoketest/data/couchbase/SampleCouchbaseApplicationTests.java index 055112021dd..8ccc8688324 100644 --- a/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-data-couchbase/src/test/java/smoketest/data/couchbase/SampleCouchbaseApplicationTests.java +++ b/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-data-couchbase/src/test/java/smoketest/data/couchbase/SampleCouchbaseApplicationTests.java @@ -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; } }