Skip to content

Commit a815376

Browse files
Add a test case per code review
1 parent 921cdc5 commit a815376

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

server/src/test/java/org/elasticsearch/transport/RemoteClusterServiceTests.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1446,7 +1446,7 @@ public void testRemoteClusterServiceEnsureClientIsEnabled() throws IOException {
14461446
);
14471447
}
14481448

1449-
// Shouldn't throw when stateless is enabled on a search node or a node with remote cluster client role.
1449+
// Shouldn't throw when stateless is enabled on a search node, or a node with remote cluster client role, or both.
14501450
final var statelessEnabledOnSearchNodeSettings = Settings.builder()
14511451
.put(nodeNameSettings)
14521452
.put(onlyRole(DiscoveryNodeRole.SEARCH_ROLE))
@@ -1463,6 +1463,14 @@ public void testRemoteClusterServiceEnsureClientIsEnabled() throws IOException {
14631463
try (RemoteClusterService service = new RemoteClusterService(statelessEnabledOnRemoteClusterClientSettings, null)) {
14641464
service.ensureClientIsEnabled();
14651465
}
1466+
final var statelessEnabledOnSearchNodeAndRemoteClusterClientSettings = Settings.builder()
1467+
.put(nodeNameSettings)
1468+
.put(onlyRoles(Set.of(DiscoveryNodeRole.SEARCH_ROLE, DiscoveryNodeRole.REMOTE_CLUSTER_CLIENT_ROLE)))
1469+
.put(DiscoveryNode.STATELESS_ENABLED_SETTING_NAME, true)
1470+
.build();
1471+
try (RemoteClusterService service = new RemoteClusterService(statelessEnabledOnSearchNodeAndRemoteClusterClientSettings, null)) {
1472+
service.ensureClientIsEnabled();
1473+
}
14661474
}
14671475

14681476
public void testRemoteClusterServiceNotEnabledGetCollectNodes() {

0 commit comments

Comments
 (0)