Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions docs/changelog/95874.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
pr: 95874
summary: Enable validation for `versionSettings`
area: "Infra/Settings"
type: bug
issues:
- 95873
Original file line number Diff line number Diff line change
Expand Up @@ -1278,7 +1278,7 @@ public static Setting<Version> versionSetting(
Validator<Version> validator,
Property... properties
) {
return new Setting<>(key, fallbackSetting, s -> Version.fromId(Integer.parseInt(s)), properties);
return new Setting<>(key, fallbackSetting, s -> Version.fromId(Integer.parseInt(s)), validator, properties);
}

public static Setting<Float> floatSetting(String key, float defaultValue, Property... properties) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -189,9 +189,13 @@ public void testSuccess() {
public static Settings.Builder randomCompatibleVersionSettings() {
Settings.Builder builder = Settings.builder();
if (randomBoolean()) {
builder.put(IndexMetadata.SETTING_VERSION_CREATED, getRandomCompatibleVersion());
Version createdVersion = getRandomCompatibleVersion();
builder.put(IndexMetadata.SETTING_VERSION_CREATED, createdVersion);
if (randomBoolean()) {
builder.put(IndexMetadata.SETTING_VERSION_COMPATIBILITY, getRandomCompatibleVersion());
builder.put(
IndexMetadata.SETTING_VERSION_COMPATIBILITY,
VersionUtils.randomVersionBetween(random(), createdVersion, Version.CURRENT)
);
}
} else {
builder.put(IndexMetadata.SETTING_VERSION_CREATED, randomFrom(Version.fromString("5.0.0"), Version.fromString("6.0.0")));
Expand Down