Monitoring: Fix NodeStatsResolverTests on Windows platforms
Because load_average is not available on Windows, it must be excluded from test assertions. Original commit: elastic/x-pack-elasticsearch@f67f9bb5e7
This commit is contained in:
parent
66e49a0546
commit
452e729a02
|
@ -151,8 +151,7 @@ public abstract class MonitoringIndexNameResolverTestCase<M extends MonitoringDo
|
||||||
|
|
||||||
if (fields != null) {
|
if (fields != null) {
|
||||||
for (String field : fields) {
|
for (String field : fields) {
|
||||||
assertNotNull("source must contain field [" + field + "] with a non-null value",
|
assertSourceField(field, sourceFields);
|
||||||
XContentMapValues.extractValue(field, sourceFields));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Checks that no extra fields are present
|
// Checks that no extra fields are present
|
||||||
|
@ -173,6 +172,11 @@ public abstract class MonitoringIndexNameResolverTestCase<M extends MonitoringDo
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected void assertSourceField(String field, Map<String, Object> sourceFields) {
|
||||||
|
assertNotNull("source must contain field [" + field + "] with a non-null value",
|
||||||
|
XContentMapValues.extractValue(field, sourceFields));
|
||||||
|
}
|
||||||
|
|
||||||
protected static String randomMonitoringId() {
|
protected static String randomMonitoringId() {
|
||||||
return randomFrom(MonitoringIds.values()).getId();
|
return randomFrom(MonitoringIds.values()).getId();
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
*/
|
*/
|
||||||
package org.elasticsearch.marvel.agent.resolver.node;
|
package org.elasticsearch.marvel.agent.resolver.node;
|
||||||
|
|
||||||
|
import org.apache.lucene.util.Constants;
|
||||||
import org.elasticsearch.Version;
|
import org.elasticsearch.Version;
|
||||||
import org.elasticsearch.action.admin.cluster.node.stats.NodeStats;
|
import org.elasticsearch.action.admin.cluster.node.stats.NodeStats;
|
||||||
import org.elasticsearch.action.admin.indices.stats.CommonStats;
|
import org.elasticsearch.action.admin.indices.stats.CommonStats;
|
||||||
|
@ -77,6 +78,15 @@ public class NodeStatsResolverTests extends MonitoringIndexNameResolverTestCase<
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void assertSourceField(String field, Map<String, Object> sourceFields) {
|
||||||
|
// Assertions on node stats fields that are not reported on Windows platforms
|
||||||
|
if (Constants.WINDOWS && field.startsWith("node_stats.os.cpu.load_average")) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
super.assertSourceField(field, sourceFields);
|
||||||
|
}
|
||||||
|
|
||||||
public void testNodeStatsResolver() throws IOException {
|
public void testNodeStatsResolver() throws IOException {
|
||||||
NodeStatsMonitoringDoc doc = newMarvelDoc();
|
NodeStatsMonitoringDoc doc = newMarvelDoc();
|
||||||
doc.setTimestamp(1437580442979L);
|
doc.setTimestamp(1437580442979L);
|
||||||
|
|
Loading…
Reference in New Issue