Skip to content

Commit 23a4e4a

Browse files
authored
Fix and re-enable ClusterStatsNodesTests#testIngestStats (#48704)
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 #48485 closes #48684
1 parent 5cbe0fd commit 23a4e4a

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

server/src/test/java/org/elasticsearch/action/admin/cluster/stats/ClusterStatsNodesTests.java

+2-4
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121

2222
import org.elasticsearch.action.admin.cluster.node.info.NodeInfo;
2323
import org.elasticsearch.action.admin.cluster.node.stats.NodeStats;
24+
import org.elasticsearch.action.admin.cluster.node.stats.NodeStatsTests;
2425
import org.elasticsearch.cluster.node.DiscoveryNode;
2526
import org.elasticsearch.common.network.NetworkModule;
2627
import org.elasticsearch.common.settings.Settings;
@@ -37,7 +38,6 @@
3738

3839
import static java.util.Collections.emptyList;
3940
import static java.util.Collections.singletonList;
40-
import static org.elasticsearch.action.admin.cluster.node.stats.NodeStatsTests.createNodeStats;
4141
import static org.elasticsearch.common.xcontent.XContentHelper.toXContent;
4242
import static org.hamcrest.Matchers.equalTo;
4343

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

70-
@AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/48684")
7170
public void testIngestStats() throws Exception {
72-
NodeStats nodeStats = createNodeStats();
73-
71+
NodeStats nodeStats = randomValueOtherThanMany(n -> n.getIngestStats() == null, NodeStatsTests::createNodeStats);
7472
SortedMap<String, long[]> processorStats = new TreeMap<>();
7573
nodeStats.getIngestStats().getProcessorStats().values().forEach(l -> l.forEach(s -> processorStats.put(s.getType(),
7674
new long[] { s.getStats().getIngestCount(), s.getStats().getIngestFailedCount(),

0 commit comments

Comments
 (0)