Monitoring: Clean up MonitoringIT
We recently reenabled MonitoringIT to hunt down but some of its
assertions were out of date. This updates the assertions.
@@ -67,6 +67,7 @@ import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcke
import static org.elasticsearch.threadpool.ThreadPool.Names.WRITE;
import static org.elasticsearch.xpack.core.monitoring.exporter.MonitoringTemplateUtils.TEMPLATE_VERSION;
import static org.hamcrest.Matchers.containsString;
+import static org.hamcrest.Matchers.empty;
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.greaterThan;
import static org.hamcrest.Matchers.greaterThanOrEqualTo;
@@ -339,7 +340,7 @@ public class MonitoringIT extends ESSingleNodeTestCase {
final Map<String, Object> clusterStats = (Map<String, Object>) source.get("cluster_stats");
assertThat(clusterStats, notNullValue());
- assertThat(clusterStats.size(), equalTo(4));
+ assertThat(clusterStats.size(), equalTo(5));
final Map<String, Object> stackStats = (Map<String, Object>) source.get("stack_stats");
assertThat(stackStats, notNullValue());
@@ -349,7 +350,7 @@ public class MonitoringIT extends ESSingleNodeTestCase {
assertThat(apm, notNullValue());
assertThat(apm.size(), equalTo(1));
assertThat(apm.remove("found"), is(apmIndicesExist));
- assertThat(apm.isEmpty(), is(true));
+ assertThat(apm.keySet(), empty());
final Map<String, Object> xpackStats = (Map<String, Object>) stackStats.get("xpack");
assertThat(xpackStats, notNullValue());
@@ -361,14 +362,14 @@ public class MonitoringIT extends ESSingleNodeTestCase {
final Map<String, Object> clusterState = (Map<String, Object>) source.get("cluster_state");
assertThat(clusterState, notNullValue());
- assertThat(clusterState.size(), equalTo(6));
assertThat(clusterState.remove("nodes_hash"), notNullValue());
assertThat(clusterState.remove("status"), notNullValue());
assertThat(clusterState.remove("version"), notNullValue());
assertThat(clusterState.remove("state_uuid"), notNullValue());
+ assertThat(clusterState.remove("cluster_uuid"), notNullValue());
assertThat(clusterState.remove("master_node"), notNullValue());
assertThat(clusterState.remove("nodes"), notNullValue());
- assertThat(clusterState.isEmpty(), is(true));
+ assertThat(clusterState.keySet(), empty());
}
/**
@@ -454,6 +455,11 @@ public class MonitoringIT extends ESSingleNodeTestCase {
return;
}
+ // bulk is not a thread pool in the current version but we allow it to support mixed version clusters
+ if (filter.startsWith("node_stats.thread_pool.bulk")) {
+ return;
+ }
+
assertThat(filter + " must not be null in the monitoring document", extractValue(filter, source), notNullValue());
});
}
