Skip to content

Commit

Permalink
Fixing flaky test testRemoteIndexPathFileExistsAfterMigration (opense…
Browse files Browse the repository at this point in the history
…arch-project#15977)

Signed-off-by: Shubh Sahu <[email protected]>
  • Loading branch information
astute-decipher authored Sep 23, 2024
1 parent 036f6bc commit 1343367
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
import org.opensearch.common.settings.Settings;
import org.opensearch.core.util.FileSystemUtils;
import org.opensearch.index.remote.RemoteIndexPath;
import org.opensearch.index.remote.RemoteIndexPathUploader;
import org.opensearch.index.remote.RemoteStoreEnums;
import org.opensearch.indices.replication.common.ReplicationType;
import org.opensearch.test.InternalTestCluster;
Expand Down Expand Up @@ -533,17 +532,18 @@ public void testRemoteIndexPathFileExistsAfterMigration() throws Exception {

// validate remote index path file exists
logger.info("---> Asserting remote index path file exists");
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(fileNamePrefix)));
logger.info(files[0].toString());
assertTrue(Arrays.stream(files).anyMatch(file -> file.toString().contains(indexUUID)));

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(fileNamePrefix)));
logger.info(files[0].toString());
assertTrue(Arrays.stream(files).anyMatch(file -> file.toString().contains(indexUUID)));
}

/**
Expand Down

0 comments on commit 1343367

Please sign in to comment.