Fix test which still uses default type (#39997)

org.elasticsearch.xpack.monitoring.action.MonitoringBulkRequestTests#testAddRequestContent
can still randomly use a defaultType for monitoring. The defaultType
support has been removed as of PR #39888. Prior to its's removal it
would default the type if one is not specified. The _type on the monitoring
bulk end point is currently required, though it is not used as the final index type
(which defaultType would have).

Closes #39980
This commit is contained in:
Jake Landis 2019-03-13 14:22:21 -05:00
parent c02f49e9d3
commit e9fa7767ec
No known key found for this signature in database
GPG Key ID: 508157BFF65D51DD
1 changed files with 5 additions and 6 deletions

View File

@ -76,7 +76,6 @@ public class MonitoringBulkRequestTests extends ESTestCase {
public void testAddRequestContent() throws IOException {
final XContentType xContentType = XContentType.JSON;
final String defaultType = rarely() ? randomAlphaOfLength(4) : null;
final int nbDocs = randomIntBetween(1, 20);
final String[] types = new String[nbDocs];
@ -93,10 +92,10 @@ public class MonitoringBulkRequestTests extends ESTestCase {
if (rarely()) {
builder.field("_index", "");
}
if (defaultType == null || randomBoolean()) {
types[i] = randomAlphaOfLength(5);
builder.field("_type", types[i]);
}
types[i] = randomAlphaOfLength(5);
builder.field("_type", types[i]);
if (randomBoolean()) {
ids[i] = randomAlphaOfLength(10);
builder.field("_id", ids[i]);
@ -133,7 +132,7 @@ public class MonitoringBulkRequestTests extends ESTestCase {
int count = 0;
for (final MonitoringBulkDoc bulkDoc : bulkDocs) {
assertThat(bulkDoc.getSystem(), equalTo(system));
assertThat(bulkDoc.getType(), equalTo(types[count] != null ? types[count] : defaultType));
assertThat(bulkDoc.getType(), equalTo(types[count]));
assertThat(bulkDoc.getId(), equalTo(ids[count]));
assertThat(bulkDoc.getTimestamp(), equalTo(timestamp));
assertThat(bulkDoc.getIntervalMillis(), equalTo(interval));