Skip to content

Commit da43393

Browse files
Replace -1s with -1 in ML forecast tests (#134016)
Split from #133677. This PR changes these ML forecast tests to use -1 instead of -1s. The use of units with a -1 time value is not documented as a valid value and its use should be eliminated. Once this change has been backported successfully the compatibility tests in #133677 should pass.
1 parent 56cf3f6 commit da43393

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/ml/action/ForecastJobActionRequestTests.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public void testSetDuration_GivenZero() {
5656
}
5757

5858
public void testSetDuration_GivenNegative() {
59-
IllegalArgumentException e = expectThrows(IllegalArgumentException.class, () -> new Request().setDuration("-1s"));
59+
IllegalArgumentException e = expectThrows(IllegalArgumentException.class, () -> new Request().setDuration("-1"));
6060
assertThat(e.getMessage(), equalTo("[duration] must be positive: [-1]"));
6161
}
6262

@@ -67,7 +67,7 @@ public void testSetExpiresIn_GivenZero() {
6767
}
6868

6969
public void testSetExpiresIn_GivenNegative() {
70-
IllegalArgumentException e = expectThrows(IllegalArgumentException.class, () -> new Request().setExpiresIn("-1s"));
70+
IllegalArgumentException e = expectThrows(IllegalArgumentException.class, () -> new Request().setExpiresIn("-1"));
7171
assertThat(e.getMessage(), equalTo("[expires_in] must be non-negative: [-1]"));
7272
}
7373
}

x-pack/plugin/src/yamlRestTest/resources/rest-api-spec/test/ml/forecast.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ setup:
4545
catch: /\[duration\] must be positive[:] \[-1\]/
4646
ml.forecast:
4747
job_id: "forecast-job"
48-
duration: "-1s"
48+
duration: "-1"
4949

5050
---
5151
"Test forecast given duration is too large":
@@ -61,7 +61,7 @@ setup:
6161
catch: /\[expires_in\] must be non-negative[:] \[-1\]/
6262
ml.forecast:
6363
job_id: "forecast-job"
64-
expires_in: "-1s"
64+
expires_in: "-1"
6565
---
6666
"Test forecast given max_model_memory is too large":
6767
- do:

0 commit comments

Comments
 (0)