Skip to content

Commit

Permalink
Addressed comment on PR
Browse files Browse the repository at this point in the history
Signed-off-by: Shubh Sahu <[email protected]>
  • Loading branch information
Shubh Sahu committed May 14, 2024
1 parent 743aaef commit c47dc57
Showing 1 changed file with 6 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -467,7 +467,7 @@ public void testRemotePathMetadataAddedWithFirstPrimaryMovingToRemote() throws E
* make the cluster mixed, add remote cluster-manager and data nodes.
* <p>
* exclude docrep nodes, assert that remote index path file exists
* after all shards have been relocated to the remote nodes.
* when shards start relocating to the remote nodes.
*/
public void testRemoteIndexPathFileExistsAfterMigration() throws Exception {
String docrepClusterManager = internalCluster().startClusterManagerOnlyNode();
Expand Down Expand Up @@ -527,20 +527,17 @@ public void testRemoteIndexPathFileExistsAfterMigration() throws Exception {

// validate remote index path file exists
logger.info("---> Asserting remote index path file exists");
String fileName = String.join(RemoteIndexPathUploader.DELIMITER, indexUUID, "7", RemoteIndexPath.DEFAULT_VERSION);
FileSystemUtils.files(translogRepoPath);
assertTrue(FileSystemUtils.exists(translogRepoPath.resolve(RemoteIndexPath.DIR)));
String fileNamePrefix = String.join(RemoteIndexPathUploader.DELIMITER, indexUUID, "7", RemoteIndexPath.DEFAULT_VERSION);

assertTrue(FileSystemUtils.exists(translogRepoPath.resolve(RemoteIndexPath.DIR)));
Path[] files = FileSystemUtils.files(translogRepoPath.resolve(RemoteIndexPath.DIR));
assertEquals(1, files.length);
assertTrue(Arrays.stream(files).anyMatch(file -> file.toString().contains(fileName)));
String translogPathFile = files[0].toString();
assertTrue(Arrays.stream(files).anyMatch(file -> file.toString().contains(fileNamePrefix)));

assertTrue(FileSystemUtils.exists(segmentRepoPath.resolve(RemoteIndexPath.DIR)));
files = FileSystemUtils.files(segmentRepoPath.resolve(RemoteIndexPath.DIR));
assertEquals(1, files.length);
assertTrue(Arrays.stream(files).anyMatch(file -> file.toString().contains(fileName)));
String segmentPathFile = files[0].toString();
assertNotEquals(translogPathFile, segmentPathFile);
assertTrue(Arrays.stream(files).anyMatch(file -> file.toString().contains(fileNamePrefix)));
}

private void createIndexAndAssertDocrepProperties(String index, Settings settings) {
Expand Down

0 comments on commit c47dc57

Please sign in to comment.