diff --git a/server/src/test/java/org/elasticsearch/action/admin/cluster/node/stats/NodeStatsTests.java b/server/src/test/java/org/elasticsearch/action/admin/cluster/node/stats/NodeStatsTests.java index bdac14f1261a3..2bd909a5e594f 100644 --- a/server/src/test/java/org/elasticsearch/action/admin/cluster/node/stats/NodeStatsTests.java +++ b/server/src/test/java/org/elasticsearch/action/admin/cluster/node/stats/NodeStatsTests.java @@ -480,21 +480,34 @@ public static NodeStats createNodeStats() { : null; IngestStats ingestStats = null; if (frequently()) { - IngestStats.Stats totalStats = new IngestStats.Stats(randomNonNegativeLong(), randomNonNegativeLong(), randomNonNegativeLong(), - randomNonNegativeLong()); int numPipelines = randomIntBetween(0, 10); int numProcessors = randomIntBetween(0, 10); + long maxStatValue = Long.MAX_VALUE / Math.max(1, numPipelines) / Math.max(1, numProcessors); + IngestStats.Stats totalStats = new IngestStats.Stats( + randomLongBetween(0, maxStatValue), + randomLongBetween(0, maxStatValue), + randomLongBetween(0, maxStatValue), + randomLongBetween(0, maxStatValue) + ); List ingestPipelineStats = new ArrayList<>(numPipelines); Map> ingestProcessorStats = new HashMap<>(numPipelines); for (int i = 0; i < numPipelines; i++) { String pipelineId = randomAlphaOfLengthBetween(3, 10); - ingestPipelineStats.add(new IngestStats.PipelineStat(pipelineId, new IngestStats.Stats - (randomNonNegativeLong(), randomNonNegativeLong(), randomNonNegativeLong(), randomNonNegativeLong()))); + ingestPipelineStats.add(new IngestStats.PipelineStat(pipelineId, new IngestStats.Stats( + randomLongBetween(0, maxStatValue), + randomLongBetween(0, maxStatValue), + randomLongBetween(0, maxStatValue), + randomLongBetween(0, maxStatValue)) + )); List processorPerPipeline = new ArrayList<>(numProcessors); for (int j =0; j < numProcessors;j++) { - IngestStats.Stats processorStats = new IngestStats.Stats - (randomNonNegativeLong(), randomNonNegativeLong(), randomNonNegativeLong(), randomNonNegativeLong()); + IngestStats.Stats processorStats = new IngestStats.Stats( + randomLongBetween(0, maxStatValue), + randomLongBetween(0, maxStatValue), + randomLongBetween(0, maxStatValue), + randomLongBetween(0, maxStatValue) + ); processorPerPipeline.add(new IngestStats.ProcessorStat(randomAlphaOfLengthBetween(3, 10), randomAlphaOfLengthBetween(3, 10), processorStats)); }