Skip to content

Commit 6a027c2

Browse files
fix test which I commented out
1 parent c87499d commit 6a027c2

File tree

1 file changed

+20
-17
lines changed

1 file changed

+20
-17
lines changed

server/src/test/java/org/elasticsearch/ingest/IngestStatsTests.java

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -234,23 +234,26 @@ public void testProcessorStatsMerge() {
234234
)
235235
);
236236
}
237-
// TODO
238-
// public void testProcessorStatsMergeHeterogeneous() {
239-
// // if a pipeline has heterogeneous *non-zero* stats, then we defer to the one with a smaller total ingest count
240-
//
241-
// var first = Map.of(
242-
// "pipeline-1",
243-
// List.of(
244-
// new IngestStats.ProcessorStat("name-1", "type-1", new IngestStats.Stats(randomLongBetween(1, 100), 0, 0, 0)),
245-
// new IngestStats.ProcessorStat("name-2", "type-2", new IngestStats.Stats(randomLongBetween(1, 100), 0, 0, 0))
246-
// )
247-
// );
248-
// var expected = List.of(new IngestStats.ProcessorStat("name-1", "type-1", new IngestStats.Stats(1, 0, 0, 0)));
249-
// var second = Map.of("pipeline-1", expected);
250-
//
251-
// assertEquals(second, IngestStats.merge(first, second));
252-
// assertSame(expected, IngestStats.merge(second, first).get("pipeline-1"));
253-
// }
237+
238+
public void testProcessorStatsMergeHeterogeneous() {
239+
// if a pipeline has heterogeneous *non-zero* stats, then we defer to the one with a smaller total ingest count
240+
241+
var first = Map.of(
242+
ProjectId.fromId("project-1"),
243+
Map.of(
244+
"pipeline-1",
245+
List.of(
246+
new IngestStats.ProcessorStat("name-1", "type-1", new IngestStats.Stats(randomLongBetween(1, 100), 0, 0, 0)),
247+
new IngestStats.ProcessorStat("name-2", "type-2", new IngestStats.Stats(randomLongBetween(1, 100), 0, 0, 0))
248+
)
249+
)
250+
);
251+
var expected = List.of(new IngestStats.ProcessorStat("name-1", "type-1", new IngestStats.Stats(1, 0, 0, 0)));
252+
var second = Map.of(ProjectId.fromId("project-1"), Map.of("pipeline-1", expected));
253+
254+
assertEquals(second, IngestStats.merge(first, second));
255+
assertSame(expected, IngestStats.merge(second, first).get(ProjectId.fromId("project-1")).get("pipeline-1"));
256+
}
254257

255258
private static List<IngestStats.ProcessorStat> expectedPipelineProcessorStats(
256259
List<IngestStats.ProcessorStat> first,

0 commit comments

Comments
 (0)