Skip to content

Commit

Permalink
Fix and re-enable ClusterStatsNodesTests#testIngestStats (elastic#48704)
Browse files Browse the repository at this point in the history
This commit creates random NodesStats until IngestStats is not null, so
that it can be properly tested. This is done as to not change the existing
behavior of createNodesStats since it depends on IngestStats being null
at times for serialization testing purposes. I think it is OK to do this since
it is unlikely that it will be null.

relates elastic#48485

closes elastic#48684
  • Loading branch information
talevy authored and debadair committed Nov 13, 2019
1 parent ad0d349 commit 1291a6d
Showing 1 changed file with 2 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

import org.elasticsearch.action.admin.cluster.node.info.NodeInfo;
import org.elasticsearch.action.admin.cluster.node.stats.NodeStats;
import org.elasticsearch.action.admin.cluster.node.stats.NodeStatsTests;
import org.elasticsearch.cluster.node.DiscoveryNode;
import org.elasticsearch.common.network.NetworkModule;
import org.elasticsearch.common.settings.Settings;
Expand All @@ -37,7 +38,6 @@

import static java.util.Collections.emptyList;
import static java.util.Collections.singletonList;
import static org.elasticsearch.action.admin.cluster.node.stats.NodeStatsTests.createNodeStats;
import static org.elasticsearch.common.xcontent.XContentHelper.toXContent;
import static org.hamcrest.Matchers.equalTo;

Expand Down Expand Up @@ -67,10 +67,8 @@ public void testNetworkTypesToXContent() throws Exception {
+ "}", toXContent(stats, XContentType.JSON, randomBoolean()).utf8ToString());
}

@AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/48684")
public void testIngestStats() throws Exception {
NodeStats nodeStats = createNodeStats();

NodeStats nodeStats = randomValueOtherThanMany(n -> n.getIngestStats() == null, NodeStatsTests::createNodeStats);
SortedMap<String, long[]> processorStats = new TreeMap<>();
nodeStats.getIngestStats().getProcessorStats().values().forEach(l -> l.forEach(s -> processorStats.put(s.getType(),
new long[] { s.getStats().getIngestCount(), s.getStats().getIngestFailedCount(),
Expand Down

0 comments on commit 1291a6d

Please sign in to comment.