|
|
@@ -25,8 +25,10 @@ import java.util.Collection;
|
|
|
import java.util.List;
|
|
|
|
|
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
|
|
|
+import static org.hamcrest.Matchers.arrayContaining;
|
|
|
import static org.hamcrest.Matchers.containsInAnyOrder;
|
|
|
import static org.hamcrest.Matchers.equalTo;
|
|
|
+import static org.hamcrest.Matchers.hasSize;
|
|
|
|
|
|
public class CCSFieldCapabilitiesIT extends AbstractMultiClustersTestCase {
|
|
|
|
|
|
@@ -35,6 +37,11 @@ public class CCSFieldCapabilitiesIT extends AbstractMultiClustersTestCase {
|
|
|
return List.of("remote_cluster");
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ protected boolean reuseClusters() {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
protected Collection<Class<? extends Plugin>> nodePlugins(String clusterAlias) {
|
|
|
final List<Class<? extends Plugin>> plugins = new ArrayList<>(super.nodePlugins(clusterAlias));
|
|
|
@@ -105,4 +112,17 @@ public class CCSFieldCapabilitiesIT extends AbstractMultiClustersTestCase {
|
|
|
assertEquals(IllegalArgumentException.class, ex.getClass());
|
|
|
assertEquals("I throw because I choose to.", ex.getMessage());
|
|
|
}
|
|
|
+
|
|
|
+ public void testFailedToConnectToRemoteCluster() throws Exception {
|
|
|
+ String localIndex = "local_index";
|
|
|
+ assertAcked(client(LOCAL_CLUSTER).admin().indices().prepareCreate(localIndex));
|
|
|
+ client(LOCAL_CLUSTER).prepareIndex(localIndex).setId("1").setSource("foo", "bar").get();
|
|
|
+ client(LOCAL_CLUSTER).admin().indices().prepareRefresh(localIndex).get();
|
|
|
+ cluster("remote_cluster").close();
|
|
|
+ FieldCapabilitiesResponse response = client().prepareFieldCaps("*", "remote_cluster:*").setFields("*").get();
|
|
|
+ assertThat(response.getIndices(), arrayContaining(localIndex));
|
|
|
+ List<FieldCapabilitiesFailure> failures = response.getFailures();
|
|
|
+ assertThat(failures, hasSize(1));
|
|
|
+ assertThat(failures.get(0).getIndices(), arrayContaining("remote_cluster:*"));
|
|
|
+ }
|
|
|
}
|