From ed9f5e7bb421f77e8ad8a1333729dc95b90b5f80 Mon Sep 17 00:00:00 2001 From: Pranshu Shukla Date: Tue, 3 Dec 2024 16:16:40 +0530 Subject: [PATCH] fix forbiddenApisInternalClusterTest Signed-off-by: Pranshu Shukla --- .../java/org/opensearch/discovery/DiscoveryDisruptionIT.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/server/src/internalClusterTest/java/org/opensearch/discovery/DiscoveryDisruptionIT.java b/server/src/internalClusterTest/java/org/opensearch/discovery/DiscoveryDisruptionIT.java index a0305261d3374..2f6ea600d895f 100644 --- a/server/src/internalClusterTest/java/org/opensearch/discovery/DiscoveryDisruptionIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/discovery/DiscoveryDisruptionIT.java @@ -41,6 +41,7 @@ import org.opensearch.cluster.node.DiscoveryNode; import org.opensearch.cluster.node.DiscoveryNodes; import org.opensearch.cluster.service.ClusterService; +import org.opensearch.common.Randomness; import org.opensearch.common.settings.Settings; import org.opensearch.repositories.RepositoriesService; import org.opensearch.repositories.fs.ReloadableFsRepository; @@ -56,7 +57,6 @@ import java.util.Arrays; import java.util.HashSet; import java.util.List; -import java.util.Random; import java.util.Set; import java.util.concurrent.CountDownLatch; import java.util.stream.Collectors; @@ -304,8 +304,7 @@ public void testElectClusterManagerRemotePublicationConfigurationNodeJoinCommitF internalCluster().stopCurrentClusterManagerNode(); ensureStableCluster(6); - Random random = new Random(); - String randomNode = nonClusterManagerNodes.get(random.nextInt(nonClusterManagerNodes.size())); + String randomNode = nonClusterManagerNodes.get(Randomness.get().nextInt(nonClusterManagerNodes.size())); RepositoriesMetadata repositoriesMetadata = internalCluster().getInstance(ClusterService.class, randomNode) .state()