Skip to content

Commit e9fa776

Browse files
committed
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
1 parent c02f49e commit e9fa776

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

x-pack/plugin/monitoring/src/test/java/org/elasticsearch/xpack/monitoring/action/MonitoringBulkRequestTests.java

+5-6
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,6 @@ public void testAdd() throws IOException {
7676

7777
public void testAddRequestContent() throws IOException {
7878
final XContentType xContentType = XContentType.JSON;
79-
final String defaultType = rarely() ? randomAlphaOfLength(4) : null;
8079

8180
final int nbDocs = randomIntBetween(1, 20);
8281
final String[] types = new String[nbDocs];
@@ -93,10 +92,10 @@ public void testAddRequestContent() throws IOException {
9392
if (rarely()) {
9493
builder.field("_index", "");
9594
}
96-
if (defaultType == null || randomBoolean()) {
97-
types[i] = randomAlphaOfLength(5);
98-
builder.field("_type", types[i]);
99-
}
95+
96+
types[i] = randomAlphaOfLength(5);
97+
builder.field("_type", types[i]);
98+
10099
if (randomBoolean()) {
101100
ids[i] = randomAlphaOfLength(10);
102101
builder.field("_id", ids[i]);
@@ -133,7 +132,7 @@ public void testAddRequestContent() throws IOException {
133132
int count = 0;
134133
for (final MonitoringBulkDoc bulkDoc : bulkDocs) {
135134
assertThat(bulkDoc.getSystem(), equalTo(system));
136-
assertThat(bulkDoc.getType(), equalTo(types[count] != null ? types[count] : defaultType));
135+
assertThat(bulkDoc.getType(), equalTo(types[count]));
137136
assertThat(bulkDoc.getId(), equalTo(ids[count]));
138137
assertThat(bulkDoc.getTimestamp(), equalTo(timestamp));
139138
assertThat(bulkDoc.getIntervalMillis(), equalTo(interval));

0 commit comments

Comments
 (0)