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.
This commit is contained in:
Nik Everett 2018-08-21 16:04:16 -04:00
parent 3973bb4028
commit f311680176
1 changed files with 10 additions and 4 deletions

View File

@ -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;
@ -336,7 +337,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());
@ -346,7 +347,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());
@ -358,14 +359,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());
}
/**
@ -451,6 +452,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());
});
}