Adjusts test to work for new cardinality limit. Backport of #54165
This commit is contained in:
parent
2fdf6b2f96
commit
ba09a778dc
|
@ -349,15 +349,20 @@ public class ClassificationIT extends MlNativeDataFrameAnalyticsIntegTestCase {
|
|||
assertEvaluation(KEYWORD_FIELD, KEYWORD_FIELD_VALUES, "ml." + predictedClassField);
|
||||
}
|
||||
|
||||
@AwaitsFix(bugUrl = "Muted until ml-cpp supports multiple classes")
|
||||
public void testDependentVariableCardinalityTooHighError() throws Exception {
|
||||
initialize("cardinality_too_high");
|
||||
indexData(sourceIndex, 6, 5, KEYWORD_FIELD);
|
||||
|
||||
// Index one more document with a class different than the two already used.
|
||||
client().execute(
|
||||
IndexAction.INSTANCE,
|
||||
new IndexRequest(sourceIndex).setRefreshPolicy(WriteRequest.RefreshPolicy.IMMEDIATE).source(KEYWORD_FIELD, "fox")).actionGet();
|
||||
// Index enough documents to have more classes than the allowed limit
|
||||
BulkRequestBuilder bulkRequestBuilder = client().prepareBulk().setRefreshPolicy(WriteRequest.RefreshPolicy.IMMEDIATE);
|
||||
for (int i = 0; i < Classification.MAX_DEPENDENT_VARIABLE_CARDINALITY - 1; i++) {
|
||||
IndexRequest indexRequest = new IndexRequest(sourceIndex).source(KEYWORD_FIELD, "fox-" + i);
|
||||
bulkRequestBuilder.add(indexRequest);
|
||||
}
|
||||
BulkResponse bulkResponse = bulkRequestBuilder.get();
|
||||
if (bulkResponse.hasFailures()) {
|
||||
fail("Failed to index data: " + bulkResponse.buildFailureMessage());
|
||||
}
|
||||
|
||||
DataFrameAnalyticsConfig config = buildAnalytics(jobId, sourceIndex, destIndex, null, new Classification(KEYWORD_FIELD));
|
||||
registerAnalytics(config);
|
||||
|
@ -365,7 +370,7 @@ public class ClassificationIT extends MlNativeDataFrameAnalyticsIntegTestCase {
|
|||
|
||||
ElasticsearchStatusException e = expectThrows(ElasticsearchStatusException.class, () -> startAnalytics(jobId));
|
||||
assertThat(e.status().getStatus(), equalTo(400));
|
||||
assertThat(e.getMessage(), equalTo("Field [keyword-field] must have at most [2] distinct values but there were at least [3]"));
|
||||
assertThat(e.getMessage(), equalTo("Field [keyword-field] must have at most [30] distinct values but there were at least [31]"));
|
||||
}
|
||||
|
||||
public void testDependentVariableCardinalityTooHighButWithQueryMakesItWithinRange() throws Exception {
|
||||
|
|
Loading…
Reference in New Issue