From 342b6edaccd8332796b35e6656d104dc5328b8f9 Mon Sep 17 00:00:00 2001 From: Poojita Raj Date: Fri, 4 Aug 2023 16:28:34 -0700 Subject: [PATCH] add annotation + refactor Signed-off-by: Poojita Raj --- .../cluster/routing/ShardMovementStrategy.java | 2 ++ .../opensearch/cluster/routing/RoutingNodesTests.java | 10 +++++----- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/server/src/main/java/org/opensearch/cluster/routing/ShardMovementStrategy.java b/server/src/main/java/org/opensearch/cluster/routing/ShardMovementStrategy.java index ef5b8bb928d9b..cfdeed5c227b6 100644 --- a/server/src/main/java/org/opensearch/cluster/routing/ShardMovementStrategy.java +++ b/server/src/main/java/org/opensearch/cluster/routing/ShardMovementStrategy.java @@ -17,6 +17,8 @@ * * ShardMovementStrategy values or rather their string representation to be used with * {@link BalancedShardsAllocator#SHARD_MOVEMENT_STRATEGY_SETTING} via cluster settings. + * + * @opensearch.internal */ public enum ShardMovementStrategy { /** diff --git a/server/src/test/java/org/opensearch/cluster/routing/RoutingNodesTests.java b/server/src/test/java/org/opensearch/cluster/routing/RoutingNodesTests.java index 1304fd5564a2c..23056ec5782bb 100644 --- a/server/src/test/java/org/opensearch/cluster/routing/RoutingNodesTests.java +++ b/server/src/test/java/org/opensearch/cluster/routing/RoutingNodesTests.java @@ -156,11 +156,11 @@ public void testInterleavedShardIteratorPrimaryFirst() { if (iteratingPrimary) { iteratingPrimary = shard.primary(); } else { - assert shard.primary() == false; + assertFalse(shard.primary()); } shardCount++; } - assert shardCount == this.totalNumberOfShards; + assertEquals(shardCount, this.totalNumberOfShards); } public void testInterleavedShardIteratorNoPreference() { @@ -178,7 +178,7 @@ public void testInterleavedShardIteratorNoPreference() { final ShardRouting shard = iterator.next(); shardCount++; } - assert shardCount == this.totalNumberOfShards; + assertEquals(shardCount, this.totalNumberOfShards); } public void testInterleavedShardIteratorReplicaFirst() { @@ -199,11 +199,11 @@ public void testInterleavedShardIteratorReplicaFirst() { if (iteratingReplica) { iteratingReplica = shard.primary() == false; } else { - assert shard.primary() == true; + assertTrue(shard.primary()); } shardCount++; } - assert shardCount == this.totalNumberOfShards; + assertEquals(shardCount, this.totalNumberOfShards); } public void testSwapPrimaryWithReplica() {