From 227b974602092353d3e686622d2da4ab46a05efb Mon Sep 17 00:00:00 2001 From: Dharmesh Date: Wed, 6 Sep 2023 19:02:39 +0530 Subject: [PATCH] [Remote Store] Fixing flaky test - RemoteIndexPrimaryRelocationIT (#9807) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * [Remote Store] Fixing flaky test - RemoteIndexPrimaryRelocationIT Signed-off-by: Dharmesh 💤 * Adding numDataNodes to 0 for remot store tests Signed-off-by: Dharmesh 💤 --------- Signed-off-by: Dharmesh 💤 Signed-off-by: Kaushal Kumar --- .../indices/recovery/IndexPrimaryRelocationIT.java | 3 --- .../remotestore/RemoteIndexPrimaryRelocationIT.java | 10 +++++----- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/server/src/internalClusterTest/java/org/opensearch/indices/recovery/IndexPrimaryRelocationIT.java b/server/src/internalClusterTest/java/org/opensearch/indices/recovery/IndexPrimaryRelocationIT.java index e9962706bcd39..c049c8ed2d4a6 100644 --- a/server/src/internalClusterTest/java/org/opensearch/indices/recovery/IndexPrimaryRelocationIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/indices/recovery/IndexPrimaryRelocationIT.java @@ -56,15 +56,12 @@ public class IndexPrimaryRelocationIT extends OpenSearchIntegTestCase { private static final int RELOCATION_COUNT = 15; - public void setup() {} - public Settings indexSettings() { return Settings.builder().put("index.number_of_shards", 1).put("index.number_of_replicas", 0).build(); } public void testPrimaryRelocationWhileIndexing() throws Exception { internalCluster().ensureAtLeastNumDataNodes(randomIntBetween(2, 3)); - setup(); client().admin().indices().prepareCreate("test").setSettings(indexSettings()).setMapping("field", "type=text").get(); ensureGreen("test"); AtomicInteger numAutoGenDocs = new AtomicInteger(); diff --git a/server/src/internalClusterTest/java/org/opensearch/remotestore/RemoteIndexPrimaryRelocationIT.java b/server/src/internalClusterTest/java/org/opensearch/remotestore/RemoteIndexPrimaryRelocationIT.java index b45b19c43b3b3..66259869a5d28 100644 --- a/server/src/internalClusterTest/java/org/opensearch/remotestore/RemoteIndexPrimaryRelocationIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/remotestore/RemoteIndexPrimaryRelocationIT.java @@ -19,18 +19,17 @@ import static org.opensearch.remotestore.RemoteStoreBaseIntegTestCase.remoteStoreClusterSettings; -@OpenSearchIntegTestCase.ClusterScope(scope = OpenSearchIntegTestCase.Scope.TEST) +@OpenSearchIntegTestCase.ClusterScope(scope = OpenSearchIntegTestCase.Scope.TEST, numDataNodes = 0) public class RemoteIndexPrimaryRelocationIT extends IndexPrimaryRelocationIT { protected static final String REPOSITORY_NAME = "test-remote-store-repo"; protected Path absolutePath; - public void setup() { - absolutePath = randomRepoPath().toAbsolutePath(); - } - protected Settings nodeSettings(int nodeOrdinal) { + if (absolutePath == null) { + absolutePath = randomRepoPath().toAbsolutePath(); + } return Settings.builder() .put(super.nodeSettings(nodeOrdinal)) .put(remoteStoreClusterSettings(REPOSITORY_NAME, absolutePath)) @@ -61,6 +60,7 @@ protected Settings featureFlagSettings() { } public void testPrimaryRelocationWhileIndexing() throws Exception { + internalCluster().startClusterManagerOnlyNode(); super.testPrimaryRelocationWhileIndexing(); } }