From ca80665614ad7761e265df30a8e082a5c326a09c Mon Sep 17 00:00:00 2001 From: Marc Handalian Date: Fri, 14 Jul 2023 12:30:30 -0700 Subject: [PATCH] Fix RemoteStoreReplicationSourceTests.testGetCheckpointMetadataEmpty. This change fixes RemoteStoreReplicationSourceTests.testGetCheckpointMetadataEmpty by properly setting replication type for on primary shards. Signed-off-by: Marc Handalian --- .../RemoteStoreReplicationSourceTests.java | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/server/src/test/java/org/opensearch/indices/replication/RemoteStoreReplicationSourceTests.java b/server/src/test/java/org/opensearch/indices/replication/RemoteStoreReplicationSourceTests.java index d80d19e46e728..deae4eaca19e7 100644 --- a/server/src/test/java/org/opensearch/indices/replication/RemoteStoreReplicationSourceTests.java +++ b/server/src/test/java/org/opensearch/indices/replication/RemoteStoreReplicationSourceTests.java @@ -45,18 +45,16 @@ public class RemoteStoreReplicationSourceTests extends OpenSearchIndexLevelRepli private Store remoteStore; + private final Settings settings = Settings.builder() + .put(IndexMetadata.SETTING_REMOTE_STORE_ENABLED, true) + .put(IndexMetadata.SETTING_REPLICATION_TYPE, ReplicationType.SEGMENT) + .build(); + @Override public void setUp() throws Exception { super.setUp(); - indexShard = newStartedShard( - true, - Settings.builder() - .put(IndexMetadata.SETTING_REMOTE_STORE_ENABLED, true) - .put(IndexMetadata.SETTING_REPLICATION_TYPE, ReplicationType.SEGMENT) - .build(), - new InternalEngineFactory() - ); + indexShard = newStartedShard(true, settings, new InternalEngineFactory()); indexDoc(indexShard, "_doc", "1"); indexDoc(indexShard, "_doc", "2"); @@ -133,7 +131,7 @@ public void testGetCheckpointMetadataEmpty() throws ExecutionException, Interrup try { emptyIndexShard = newStartedShard( true, - Settings.builder().put(IndexMetadata.SETTING_REMOTE_STORE_ENABLED, true).build(), + settings, new InternalEngineFactory() ); RemoteSegmentStoreDirectory remoteSegmentStoreDirectory =