Skip to content

Commit bd9ed91

Browse files
Use 2 remotes for test and assert cluster name in failures
1 parent d447ab0 commit bd9ed91

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

server/src/internalClusterTest/java/org/elasticsearch/indices/cluster/RemoteFieldCapsForceConnectTimeoutIT.java

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030

3131
public class RemoteFieldCapsForceConnectTimeoutIT extends AbstractMultiClustersTestCase {
3232
private static final String REMOTE_CLUSTER_1 = "cluster-a";
33+
private static final String REMOTE_CLUSTER_2 = "cluster-b";
3334

3435
public static class ForceConnectTimeoutPlugin extends Plugin implements ClusterPlugin {
3536
@Override
@@ -45,7 +46,7 @@ public List<Setting<?>> getSettings() {
4546

4647
@Override
4748
protected List<String> remoteClusterAlias() {
48-
return List.of(REMOTE_CLUSTER_1);
49+
return List.of(REMOTE_CLUSTER_1, REMOTE_CLUSTER_2);
4950
}
5051

5152
@Override
@@ -65,7 +66,7 @@ protected Settings nodeSettings() {
6566

6667
@Override
6768
protected Map<String, Boolean> skipUnavailableForRemoteClusters() {
68-
return Map.of(REMOTE_CLUSTER_1, true);
69+
return Map.of(REMOTE_CLUSTER_1, true, REMOTE_CLUSTER_2, true);
6970
}
7071

7172
public void testTimeoutSetting() {
@@ -108,8 +109,14 @@ public void testTimeoutSetting() {
108109

109110
var failures = result.getFailures();
110111
assertThat(failures.size(), Matchers.is(1));
111-
var message = result.getFailures().getFirst().getException().toString();
112-
assertThat(message, Matchers.containsString("org.elasticsearch.ElasticsearchTimeoutException: timed out after [1s/1000ms]"));
112+
113+
var failure = failures.getFirst();
114+
assertThat(failure.getIndices().length, Matchers.is(1));
115+
assertThat(failure.getIndices()[0], Matchers.equalTo("cluster-a:*"));
116+
assertThat(
117+
failure.getException().toString(),
118+
Matchers.containsString("org.elasticsearch.ElasticsearchTimeoutException: timed out after [1s/1000ms]")
119+
);
113120

114121
latch.countDown();
115122
result.decRef();

0 commit comments

Comments
 (0)