Skip to content

Commit 4481794

Browse files
committed
Fixed the way roles added while creating node for testing
Signed-off-by: Vinay Krishna Pudyodu <[email protected]>
1 parent 25cf1ff commit 4481794

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

test/framework/src/main/java/org/opensearch/test/ClusterServiceUtils.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,8 @@
5757
import org.opensearch.threadpool.ThreadPool;
5858

5959
import java.util.Collections;
60+
import java.util.HashSet;
61+
import java.util.Set;
6062
import java.util.concurrent.CountDownLatch;
6163
import java.util.concurrent.atomic.AtomicReference;
6264

@@ -145,11 +147,15 @@ public void onFailure(String source, Exception e) {
145147
}
146148

147149
public static ClusterService createClusterService(ThreadPool threadPool) {
150+
// Remove the search role since we don't expect a search role to co-exist with any other role
151+
Set<DiscoveryNodeRole> nodeRoles = new HashSet<>(DiscoveryNodeRole.BUILT_IN_ROLES);
152+
nodeRoles.remove(DiscoveryNodeRole.SEARCH_ROLE);
153+
148154
DiscoveryNode discoveryNode = new DiscoveryNode(
149155
"node",
150156
OpenSearchTestCase.buildNewFakeTransportAddress(),
151157
Collections.emptyMap(),
152-
DiscoveryNodeRole.BUILT_IN_ROLES,
158+
nodeRoles,
153159
Version.CURRENT
154160
);
155161
return createClusterService(threadPool, discoveryNode);

0 commit comments

Comments
 (0)