Skip to content

Commit

Permalink
ILM setPriority corrections for a 0 value (elastic#38001)
Browse files Browse the repository at this point in the history
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 elastic#37652
  • Loading branch information
jakelandis committed Jan 31, 2019
1 parent ec8ddc8 commit cd8d66a
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public static SetPriorityAction parse(XContentParser parser) {
}

public SetPriorityAction(@Nullable Integer recoveryPriority) {
if (recoveryPriority != null && recoveryPriority <= 0) {
if (recoveryPriority != null && recoveryPriority < 0) {
throw new IllegalArgumentException("[" + RECOVERY_PRIORITY_FIELD.getPreferredName() + "] must be 0 or greater");
}
this.recoveryPriority = recoveryPriority;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ protected boolean supportsUnknownFields() {
}

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,8 @@ protected Reader<SetPriorityAction> instanceReader() {
return SetPriorityAction::new;
}

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

Expand Down

0 comments on commit cd8d66a

Please sign in to comment.