Ignore 5m and 15m system load averages in resolver tests so that Mac users can run them

Original commit: elastic/x-pack-elasticsearch@4a2a75b046
This commit is contained in:
Chris Earle 2017-01-04 11:59:05 -05:00
parent 35b405d029
commit 3c68e6dd23
2 changed files with 15 additions and 2 deletions

View File

@ -78,8 +78,10 @@ public class NodeStatsResolverTests extends MonitoringIndexNameResolverTestCase<
@Override @Override
protected void assertSourceField(String field, Map<String, Object> sourceFields) { protected void assertSourceField(String field, Map<String, Object> sourceFields) {
// Assertions on node stats fields that are not reported on Windows platforms // Assertions on node stats fields that are not reported on Windows platforms
if (Constants.WINDOWS && field.startsWith("node_stats.os.cpu.load_average")) { if (Constants.WINDOWS) {
return; if (field.startsWith("node_stats.os.cpu.load_average")) {
return;
}
} }
// we only report IoStats on Linux // we only report IoStats on Linux
@ -99,6 +101,11 @@ public class NodeStatsResolverTests extends MonitoringIndexNameResolverTestCase<
return; return;
} }
// load average is unavailable on macOS for 5m and 15m (but we get 1m), but it's also possible on Linux too
if ("node_stats.os.cpu.load_average.5m".equals(field) || "node_stats.os.cpu.load_average.15m".equals(field)) {
return;
}
super.assertSourceField(field, sourceFields); super.assertSourceField(field, sourceFields);
} }

View File

@ -71,12 +71,18 @@ public class NodeStatsTests extends MonitoringIntegTestCase {
continue; continue;
} }
} }
// fs and cgroup stats are only reported on Linux, but it's acceptable for _node/stats to report them as null if the OS is // fs and cgroup stats are only reported on Linux, but it's acceptable for _node/stats to report them as null if the OS is
// misconfigured or not reporting them for some reason (e.g., older kernel) // misconfigured or not reporting them for some reason (e.g., older kernel)
if (filter.startsWith("node_stats.fs") || filter.startsWith("node_stats.os.cgroup")) { if (filter.startsWith("node_stats.fs") || filter.startsWith("node_stats.os.cgroup")) {
continue; continue;
} }
// load average is unavailable on macOS for 5m and 15m (but we get 1m), but it's also possible on Linux too
if ("node_stats.os.cpu.load_average.5m".equals(filter) || "node_stats.os.cpu.load_average.15m".equals(filter)) {
continue;
}
assertContains(filter, fields); assertContains(filter, fields);
} }
} }