Skip to content

Commit c575cbf

Browse files
authored
ILM setPriority corrections for a 0 value (#38001) (#38136)
This commit fixes the test case that ensures only a priority less then 0 is used with testNonPositivePriority. This also allows the HLRC to support a value of 0. Closes #37652
1 parent 10b913a commit c575cbf

File tree

3 files changed

+3
-4
lines changed

3 files changed

+3
-4
lines changed

client/rest-high-level/src/main/java/org/elasticsearch/client/indexlifecycle/SetPriorityAction.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public static SetPriorityAction parse(XContentParser parser) {
5555
}
5656

5757
public SetPriorityAction(@Nullable Integer recoveryPriority) {
58-
if (recoveryPriority != null && recoveryPriority <= 0) {
58+
if (recoveryPriority != null && recoveryPriority < 0) {
5959
throw new IllegalArgumentException("[" + RECOVERY_PRIORITY_FIELD.getPreferredName() + "] must be 0 or greater");
6060
}
6161
this.recoveryPriority = recoveryPriority;

client/rest-high-level/src/test/java/org/elasticsearch/client/indexlifecycle/SetPriorityActionTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ protected boolean supportsUnknownFields() {
4848
}
4949

5050
public void testNonPositivePriority() {
51-
Exception e = expectThrows(Exception.class, () -> new SetPriorityAction(randomIntBetween(-100, 0)));
51+
Exception e = expectThrows(Exception.class, () -> new SetPriorityAction(randomIntBetween(-100, -1)));
5252
assertThat(e.getMessage(), equalTo("[priority] must be 0 or greater"));
5353
}
5454

x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/indexlifecycle/SetPriorityActionTests.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,8 @@ protected Reader<SetPriorityAction> instanceReader() {
3838
return SetPriorityAction::new;
3939
}
4040

41-
@AwaitsFix(bugUrl="https://github.com/elastic/elasticsearch/issues/37652")
4241
public void testNonPositivePriority() {
43-
Exception e = expectThrows(Exception.class, () -> new SetPriorityAction(randomIntBetween(-100, 0)));
42+
Exception e = expectThrows(Exception.class, () -> new SetPriorityAction(randomIntBetween(-100, -1)));
4443
assertThat(e.getMessage(), equalTo("[priority] must be 0 or greater"));
4544
}
4645

0 commit comments

Comments
 (0)