Skip to content

Commit

Permalink
Fix test which still uses default type (#39997)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
jakelandis committed Mar 14, 2019
1 parent c02f49e commit e9fa776
Showing 1 changed file with 5 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ public void testAdd() throws IOException {

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];
Expand All @@ -93,10 +92,10 @@ public void testAddRequestContent() throws IOException {
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]);
Expand Down Expand Up @@ -133,7 +132,7 @@ public void testAddRequestContent() throws IOException {
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));
Expand Down

0 comments on commit e9fa776

Please sign in to comment.