Skip to content

Commit 7e28af5

Browse files
committed
Monitoring: Clean up MonitoringIT
We recently reenabled MonitoringIT to hunt down #29880 but some of its assertions were out of date. This updates the assertions.
1 parent c871d4e commit 7e28af5

File tree

1 file changed

+10
-4
lines changed
  • x-pack/plugin/monitoring/src/test/java/org/elasticsearch/xpack/monitoring/integration

1 file changed

+10
-4
lines changed

x-pack/plugin/monitoring/src/test/java/org/elasticsearch/xpack/monitoring/integration/MonitoringIT.java

+10-4
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@
6767
import static org.elasticsearch.threadpool.ThreadPool.Names.WRITE;
6868
import static org.elasticsearch.xpack.core.monitoring.exporter.MonitoringTemplateUtils.TEMPLATE_VERSION;
6969
import static org.hamcrest.Matchers.containsString;
70+
import static org.hamcrest.Matchers.empty;
7071
import static org.hamcrest.Matchers.equalTo;
7172
import static org.hamcrest.Matchers.greaterThan;
7273
import static org.hamcrest.Matchers.greaterThanOrEqualTo;
@@ -339,7 +340,7 @@ private void assertClusterStatsMonitoringDoc(final Map<String, Object> document,
339340

340341
final Map<String, Object> clusterStats = (Map<String, Object>) source.get("cluster_stats");
341342
assertThat(clusterStats, notNullValue());
342-
assertThat(clusterStats.size(), equalTo(4));
343+
assertThat(clusterStats.size(), equalTo(5));
343344

344345
final Map<String, Object> stackStats = (Map<String, Object>) source.get("stack_stats");
345346
assertThat(stackStats, notNullValue());
@@ -349,7 +350,7 @@ private void assertClusterStatsMonitoringDoc(final Map<String, Object> document,
349350
assertThat(apm, notNullValue());
350351
assertThat(apm.size(), equalTo(1));
351352
assertThat(apm.remove("found"), is(apmIndicesExist));
352-
assertThat(apm.isEmpty(), is(true));
353+
assertThat(apm.keySet(), empty());
353354

354355
final Map<String, Object> xpackStats = (Map<String, Object>) stackStats.get("xpack");
355356
assertThat(xpackStats, notNullValue());
@@ -361,14 +362,14 @@ private void assertClusterStatsMonitoringDoc(final Map<String, Object> document,
361362

362363
final Map<String, Object> clusterState = (Map<String, Object>) source.get("cluster_state");
363364
assertThat(clusterState, notNullValue());
364-
assertThat(clusterState.size(), equalTo(6));
365365
assertThat(clusterState.remove("nodes_hash"), notNullValue());
366366
assertThat(clusterState.remove("status"), notNullValue());
367367
assertThat(clusterState.remove("version"), notNullValue());
368368
assertThat(clusterState.remove("state_uuid"), notNullValue());
369+
assertThat(clusterState.remove("cluster_uuid"), notNullValue());
369370
assertThat(clusterState.remove("master_node"), notNullValue());
370371
assertThat(clusterState.remove("nodes"), notNullValue());
371-
assertThat(clusterState.isEmpty(), is(true));
372+
assertThat(clusterState.keySet(), empty());
372373
}
373374

374375
/**
@@ -454,6 +455,11 @@ private void assertNodeStatsMonitoringDoc(final Map<String, Object> document) {
454455
return;
455456
}
456457

458+
// bulk is not a thread pool in the current version but we allow it to support mixed version clusters
459+
if (filter.startsWith("node_stats.thread_pool.bulk")) {
460+
return;
461+
}
462+
457463
assertThat(filter + " must not be null in the monitoring document", extractValue(filter, source), notNullValue());
458464
});
459465
}

0 commit comments

Comments
 (0)