[Monitoring] Fix test that fails with Cgroups missing on some machines
Original commit: elastic/x-pack-elasticsearch@23b7c2a25a0dc3392c02eacb03ca21a5f123dd29
@@ -45,7 +45,6 @@ public class NodeStatsTests extends MonitoringIntegTestCase {
}
public void testNodeStats() throws Exception {
- logger.debug("--> creating some indices for future node stats");
final int numDocs = between(50, 150);
for (int i = 0; i < numDocs; i++) {
client().prepareIndex("test", "foo").setSource("value", randomInt()).get();
@@ -59,32 +58,27 @@ public class NodeStatsTests extends MonitoringIntegTestCase {
awaitMonitoringDocsCount(greaterThan(0L), NodeStatsResolver.TYPE);
- logger.debug("--> searching for monitoring documents of type [{}]", NodeStatsResolver.TYPE);
SearchResponse response = client().prepareSearch().setTypes(NodeStatsResolver.TYPE).get();
assertThat(response.getHits().getTotalHits(), greaterThan(0L));
- logger.debug("--> checking that every document contains the expected fields");
-
for (SearchHit searchHit : response.getHits().getHits()) {
Map<String, Object> fields = searchHit.sourceAsMap();
for (String filter : nodeStatsFilters(watcherEnabled)) {
if (Constants.WINDOWS) {
// load average is unavailable on Windows
- if ("node_stats.os.cpu.load_average.1m".equals(filter)) {
+ if (filter.startsWith("node_stats.os.cpu.load_average")) {
continue;
}
}
- if (filter.startsWith("node_stats.fs")) {
- // NORELEASE what is going on here?
+ // fs stats and cgroup stats are not reported on every node
+ if (filter.startsWith("node_stats.fs") || filter.startsWith("node_stats.os.cgroup")) {
continue;
}
assertContains(filter, fields);
}
}
-
- logger.debug("--> node stats successfully collected");
}
/**
