Skip to content

Commit

Permalink
Restore use of v7 index versions in snapshot tests
Browse files Browse the repository at this point in the history
Versions v7 have been filtered out when we bumped to v9, but that was not necessary.
Actually, given we decided to keep on supporting v7 indices, it is important to
restore such tests.
  • Loading branch information
javanna committed Dec 19, 2024
1 parent 6983f9a commit 12189af
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -109,16 +109,14 @@ public void testGetShardSnapshotOnEmptyRepositoriesListThrowsAnError() {
expectThrows(IllegalArgumentException.class, () -> getLatestSnapshotForShardFuture(Collections.emptyList(), "idx", 0, false));
}

@UpdateForV9(owner = UpdateForV9.Owner.DISTRIBUTED_COORDINATION)
// below we were selecting an index version between current and 7.5.0, this has been updated to 8.0.0 now but that might need to change
public void testGetShardSnapshotReturnsTheLatestSuccessfulSnapshot() throws Exception {
final String repoName = "repo-name";
final Path repoPath = randomRepoPath();
createRepository(repoName, FsRepository.TYPE, repoPath);

final boolean useBwCFormat = randomBoolean();
if (useBwCFormat) {
final IndexVersion version = randomVersionBetween(random(), IndexVersions.MINIMUM_COMPATIBLE, IndexVersion.current());
final IndexVersion version = randomVersionBetween(random(), IndexVersions.V_7_5_0, IndexVersion.current());
initWithSnapshotVersion(repoName, repoPath, version);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -367,14 +367,12 @@ protected static Settings.Builder indexSettingsNoReplicas(int shards) {
/**
* Randomly write an empty snapshot of an older version to an empty repository to simulate an older repository metadata format.
*/
@UpdateForV9(owner = UpdateForV9.Owner.DISTRIBUTED_COORDINATION)
// This used to pick an index version from 7.0.0 to 8.9.0. The minimum now is 8.0.0 but it's not clear what the upper range should be
protected void maybeInitWithOldSnapshotVersion(String repoName, Path repoPath) throws Exception {
if (randomBoolean() && randomBoolean()) {
initWithSnapshotVersion(
repoName,
repoPath,
IndexVersionUtils.randomVersionBetween(random(), IndexVersions.MINIMUM_COMPATIBLE, IndexVersions.V_8_9_0)
IndexVersionUtils.randomVersionBetween(random(), IndexVersions.V_7_0_0, IndexVersions.V_8_9_0)
);
}
}
Expand Down

0 comments on commit 12189af

Please sign in to comment.