-
Notifications
You must be signed in to change notification settings - Fork 24.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
When get filters is called without setting the `size` paramter only up to 10 filters are returned. However, 100 filters should be returned. This commit fixes this and adds an integ test to guard it. It seems this was accidentally broken in #39976. Closes #54206 Backport of #54207
- Loading branch information
1 parent
7491f7f
commit 1e83b29
Showing
9 changed files
with
68 additions
and
80 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
x-pack/plugin/ml/src/test/java/org/elasticsearch/xpack/ml/integration/MlFiltersIT.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
package org.elasticsearch.xpack.ml.integration; | ||
|
||
import org.elasticsearch.xpack.core.ml.action.GetFiltersAction; | ||
import org.elasticsearch.xpack.core.ml.action.PutFilterAction; | ||
import org.elasticsearch.xpack.core.ml.job.config.MlFilter; | ||
import org.elasticsearch.xpack.ml.MlSingleNodeTestCase; | ||
import org.junit.Before; | ||
|
||
import static org.hamcrest.Matchers.equalTo; | ||
|
||
public class MlFiltersIT extends MlSingleNodeTestCase { | ||
|
||
@Before | ||
public void beforeTests() throws Exception { | ||
waitForMlTemplates(); | ||
} | ||
|
||
public void testGetFilters_ShouldReturnUpTo100ByDefault() { | ||
int filtersCount = randomIntBetween(11, 100); | ||
for (int i = 0; i < filtersCount; i++) { | ||
PutFilterAction.Request putFilterRequest = new PutFilterAction.Request( | ||
MlFilter.builder("filter-" + i).setItems("item-" + i).build()); | ||
client().execute(PutFilterAction.INSTANCE, putFilterRequest).actionGet(); | ||
} | ||
|
||
GetFiltersAction.Response filters = client().execute(GetFiltersAction.INSTANCE, new GetFiltersAction.Request()).actionGet(); | ||
assertThat((int) filters.getFilters().count(), equalTo(filtersCount)); | ||
assertThat(filters.getFilters().results().size(), equalTo(filtersCount)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters