Skip to content

Commit ccb721b

Browse files
Force Connect Test: Fix flaky test caused by unreliable remote cluster stalling (#132641)
Fix flaky test caused by unreliable remote cluster stalling
1 parent a900dd9 commit ccb721b

File tree

3 files changed

+20
-22
lines changed

3 files changed

+20
-22
lines changed

muted-tests.yml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -455,9 +455,6 @@ tests:
455455
- class: org.elasticsearch.xpack.esql.ccq.MultiClustersIT
456456
method: testLookupJoinAliasesSkipOld
457457
issue: https://github.com/elastic/elasticsearch/issues/131697
458-
- class: org.elasticsearch.indices.cluster.RemoteSearchForceConnectTimeoutIT
459-
method: testTimeoutSetting
460-
issue: https://github.com/elastic/elasticsearch/issues/131656
461458
- class: org.elasticsearch.packaging.test.DockerTests
462459
method: test151MachineDependentHeapWithSizeOverride
463460
issue: https://github.com/elastic/elasticsearch/issues/123437
@@ -473,9 +470,6 @@ tests:
473470
- class: org.elasticsearch.index.engine.MergeWithLowDiskSpaceIT
474471
method: testRelocationWhileForceMerging
475472
issue: https://github.com/elastic/elasticsearch/issues/131789
476-
- class: org.elasticsearch.indices.cluster.FieldCapsForceConnectTimeoutIT
477-
method: testTimeoutSetting
478-
issue: https://github.com/elastic/elasticsearch/issues/132179
479473
- class: org.elasticsearch.test.rest.yaml.MDPYamlTestSuiteIT
480474
method: test {yaml=mdp/10_basic/Index using shared data path}
481475
issue: https://github.com/elastic/elasticsearch/issues/132223

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

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -73,21 +73,23 @@ protected Map<String, Boolean> skipUnavailableForRemoteClusters() {
7373

7474
public void testTimeoutSetting() {
7575
var latch = new CountDownLatch(1);
76-
for (String nodeName : cluster(LOCAL_CLUSTER).getNodeNames()) {
77-
MockTransportService mts = (MockTransportService) cluster(LOCAL_CLUSTER).getInstance(TransportService.class, nodeName);
78-
79-
mts.addConnectBehavior(
80-
cluster(LINKED_CLUSTER_1).getInstance(TransportService.class, (String) null),
81-
((transport, discoveryNode, profile, listener) -> {
76+
for (String localNodeName : cluster(LOCAL_CLUSTER).getNodeNames()) {
77+
MockTransportService localMts = (MockTransportService) cluster(LOCAL_CLUSTER).getInstance(
78+
TransportService.class,
79+
localNodeName
80+
);
81+
for (String remoteNodeName : cluster(LINKED_CLUSTER_1).getNodeNames()) {
82+
TransportService remoteTs = cluster(LINKED_CLUSTER_1).getInstance(TransportService.class, remoteNodeName);
83+
localMts.addConnectBehavior(remoteTs, ((transport, discoveryNode, profile, listener) -> {
8284
try {
8385
latch.await();
8486
} catch (InterruptedException e) {
8587
throw new AssertionError(e);
8688
}
8789

8890
transport.openConnection(discoveryNode, profile, listener);
89-
})
90-
);
91+
}));
92+
}
9193
}
9294

9395
// Add some dummy data to prove we are communicating fine with the remote.

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

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -70,21 +70,23 @@ protected Map<String, Boolean> skipUnavailableForRemoteClusters() {
7070

7171
public void testTimeoutSetting() {
7272
var latch = new CountDownLatch(1);
73-
for (String nodeName : cluster(LOCAL_CLUSTER).getNodeNames()) {
74-
MockTransportService mts = (MockTransportService) cluster(LOCAL_CLUSTER).getInstance(TransportService.class, nodeName);
75-
76-
mts.addConnectBehavior(
77-
cluster(REMOTE_CLUSTER_1).getInstance(TransportService.class, (String) null),
78-
((transport, discoveryNode, profile, listener) -> {
73+
for (String localNodeName : cluster(LOCAL_CLUSTER).getNodeNames()) {
74+
MockTransportService localMts = (MockTransportService) cluster(LOCAL_CLUSTER).getInstance(
75+
TransportService.class,
76+
localNodeName
77+
);
78+
for (String remoteNodeName : cluster(REMOTE_CLUSTER_1).getNodeNames()) {
79+
TransportService remoteTs = cluster(REMOTE_CLUSTER_1).getInstance(TransportService.class, remoteNodeName);
80+
localMts.addConnectBehavior(remoteTs, ((transport, discoveryNode, profile, listener) -> {
7981
try {
8082
latch.await();
8183
} catch (InterruptedException e) {
8284
throw new AssertionError(e);
8385
}
8486

8587
transport.openConnection(discoveryNode, profile, listener);
86-
})
87-
);
88+
}));
89+
}
8890
}
8991

9092
// Add some dummy data to prove we are communicating fine with the remote.

0 commit comments

Comments
 (0)