Skip to content

Commit

Permalink
testing CI config for registering plugin settings
Browse files Browse the repository at this point in the history
Signed-off-by: AnnTian Shao <[email protected]>
  • Loading branch information
AnnTian Shao committed Jan 22, 2025
1 parent e517731 commit 9ebab5a
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -801,6 +801,22 @@ public void testInvalidRestoreRequestScenarios() throws Exception {
);
assertTrue(exception.getMessage().contains("cannot modify UnmodifiableOnRestore setting [index.number_of_shards]" + " on restore"));

Settings creationDate = Settings.builder().put(IndexMetadata.SETTING_CREATION_DATE, -1).build();

exception = expectThrows(
SnapshotRestoreException.class,
() -> client().admin()
.cluster()
.prepareRestoreSnapshot(snapshotRepo, snapshotName1)
.setWaitForCompletion(false)
.setIndexSettings(creationDate)
.setIndices(index)
.setRenamePattern(index)
.setRenameReplacement(restoredIndex)
.get()
);
assertTrue(exception.getMessage().contains("cannot modify UnmodifiableOnRestore setting [index.creation_date]" + " on restore"));

// try index restore with index.number_of_shards setting same
Settings numberOfShardsSettingsSame = Settings.builder().put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 1).build();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,10 @@ public class RestoreService implements ClusterStateApplier {
private static final Logger logger = LogManager.getLogger(RestoreService.class);

private static final Set<String> USER_UNMODIFIABLE_SETTINGS = unmodifiableSet(
newHashSet(SETTING_INDEX_UUID, SETTING_CREATION_DATE, SETTING_HISTORY_UUID)
newHashSet(
SETTING_INDEX_UUID,
// SETTING_CREATION_DATE,
SETTING_HISTORY_UUID)
);

// It's OK to change some settings, but we shouldn't allow simply removing them
Expand Down

0 comments on commit 9ebab5a

Please sign in to comment.