Skip to content

Commit

Permalink
Add integration tests for remote store restore flow (opensearch-proje…
Browse files Browse the repository at this point in the history
…ct#8484)

Add integration tests for remote store restore flow (opensearch-project#8484)

---------

Signed-off-by: Bhumika Saini <[email protected]>
  • Loading branch information
Bhumika Saini authored and baba-devv committed Jul 29, 2023
1 parent d03f24a commit cdbd14d
Show file tree
Hide file tree
Showing 4 changed files with 364 additions and 51 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ public void testPrimaryTermValidation() throws Exception {
assertAcked(
clusterAdmin().preparePutRepository(REPOSITORY_NAME).setType("fs").setSettings(Settings.builder().put("location", absolutePath))
);
absolutePath2 = randomRepoPath().toAbsolutePath();
putRepository(absolutePath2, REPOSITORY_2_NAME);

// Start data nodes and create index
internalCluster().startDataOnlyNodes(2, clusterSettings);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,11 @@

public class RemoteStoreBaseIntegTestCase extends OpenSearchIntegTestCase {
protected static final String REPOSITORY_NAME = "test-remore-store-repo";
protected static final String REPOSITORY_2_NAME = "test-remore-store-repo-2";
protected static final int SHARD_COUNT = 1;
protected static final int REPLICA_COUNT = 1;

protected Path absolutePath;
protected Path absolutePath2;

@Override
protected boolean addMockInternalEngine() {
Expand Down Expand Up @@ -95,10 +96,11 @@ protected Settings remoteStoreIndexSettings(int numberOfReplicas, long totalFiel
}

protected Settings remoteTranslogIndexSettings(int numberOfReplicas, int numberOfShards) {
boolean sameRepoForRSSAndRTS = randomBoolean();
return Settings.builder()
.put(remoteStoreIndexSettings(numberOfReplicas, numberOfShards))
.put(IndexMetadata.SETTING_REMOTE_TRANSLOG_STORE_ENABLED, true)
.put(IndexMetadata.SETTING_REMOTE_TRANSLOG_STORE_REPOSITORY, REPOSITORY_NAME)
.put(IndexMetadata.SETTING_REMOTE_TRANSLOG_STORE_REPOSITORY, sameRepoForRSSAndRTS ? REPOSITORY_NAME : REPOSITORY_2_NAME)
.build();
}

Expand All @@ -107,20 +109,25 @@ protected Settings remoteTranslogIndexSettings(int numberOfReplicas) {
}

protected void putRepository(Path path) {
assertAcked(
clusterAdmin().preparePutRepository(REPOSITORY_NAME).setType("fs").setSettings(Settings.builder().put("location", path))
);
putRepository(path, REPOSITORY_NAME);
}

protected void putRepository(Path path, String repoName) {
assertAcked(clusterAdmin().preparePutRepository(repoName).setType("fs").setSettings(Settings.builder().put("location", path)));
}

protected void setupRepo() {
internalCluster().startClusterManagerOnlyNode();
absolutePath = randomRepoPath().toAbsolutePath();
putRepository(absolutePath);
absolutePath2 = randomRepoPath().toAbsolutePath();
putRepository(absolutePath2, REPOSITORY_2_NAME);
}

@After
public void teardown() {
assertAcked(clusterAdmin().prepareDeleteRepository(REPOSITORY_NAME));
assertAcked(clusterAdmin().prepareDeleteRepository(REPOSITORY_2_NAME));
}

public int getFileCount(Path path) throws Exception {
Expand Down
Loading

0 comments on commit cdbd14d

Please sign in to comment.