Skip to content

Commit d67faf4

Browse files
fix more test compilation
1 parent 4c43e1c commit d67faf4

File tree

1 file changed

+68
-17
lines changed

1 file changed

+68
-17
lines changed

x-pack/plugin/ml/src/test/java/org/elasticsearch/xpack/ml/action/TransportGetTrainedModelsStatsActionTests.java

Lines changed: 68 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -168,9 +168,24 @@ public void testInferenceIngestStatsByModelId() {
168168
buildNodeStats(
169169
new IngestStats.Stats(2, 2, 3, 4),
170170
Arrays.asList(
171-
new IngestStats.PipelineStat("pipeline1", new IngestStats.Stats(0, 0, 3, 1), new IngestStats.ByteStats(789, 0)),
172-
new IngestStats.PipelineStat("pipeline2", new IngestStats.Stats(1, 1, 0, 1), new IngestStats.ByteStats(123, 123)),
173-
new IngestStats.PipelineStat("pipeline3", new IngestStats.Stats(2, 1, 1, 1), new IngestStats.ByteStats(1234, 5678))
171+
new IngestStats.PipelineStat(
172+
ProjectId.DEFAULT,
173+
"pipeline1",
174+
new IngestStats.Stats(0, 0, 3, 1),
175+
new IngestStats.ByteStats(789, 0)
176+
),
177+
new IngestStats.PipelineStat(
178+
ProjectId.DEFAULT,
179+
"pipeline2",
180+
new IngestStats.Stats(1, 1, 0, 1),
181+
new IngestStats.ByteStats(123, 123)
182+
),
183+
new IngestStats.PipelineStat(
184+
ProjectId.DEFAULT,
185+
"pipeline3",
186+
new IngestStats.Stats(2, 1, 1, 1),
187+
new IngestStats.ByteStats(1234, 5678)
188+
)
174189
),
175190
Arrays.asList(
176191
Arrays.asList(
@@ -192,9 +207,24 @@ public void testInferenceIngestStatsByModelId() {
192207
buildNodeStats(
193208
new IngestStats.Stats(15, 5, 3, 4),
194209
Arrays.asList(
195-
new IngestStats.PipelineStat("pipeline1", new IngestStats.Stats(10, 1, 3, 1), new IngestStats.ByteStats(5678, 123456)),
196-
new IngestStats.PipelineStat("pipeline2", new IngestStats.Stats(1, 1, 0, 1), new IngestStats.ByteStats(111, 222)),
197-
new IngestStats.PipelineStat("pipeline3", new IngestStats.Stats(2, 1, 1, 1), new IngestStats.ByteStats(555, 777))
210+
new IngestStats.PipelineStat(
211+
ProjectId.DEFAULT,
212+
"pipeline1",
213+
new IngestStats.Stats(10, 1, 3, 1),
214+
new IngestStats.ByteStats(5678, 123456)
215+
),
216+
new IngestStats.PipelineStat(
217+
ProjectId.DEFAULT,
218+
"pipeline2",
219+
new IngestStats.Stats(1, 1, 0, 1),
220+
new IngestStats.ByteStats(111, 222)
221+
),
222+
new IngestStats.PipelineStat(
223+
ProjectId.DEFAULT,
224+
"pipeline3",
225+
new IngestStats.Stats(2, 1, 1, 1),
226+
new IngestStats.ByteStats(555, 777)
227+
)
198228
),
199229
Arrays.asList(
200230
Arrays.asList(
@@ -230,24 +260,42 @@ public void testInferenceIngestStatsByModelId() {
230260
IngestStats expectedStatsModel1 = new IngestStats(
231261
new IngestStats.Stats(10, 1, 6, 2),
232262
Collections.singletonList(
233-
new IngestStats.PipelineStat("pipeline1", new IngestStats.Stats(10, 1, 6, 2), new IngestStats.ByteStats(6467, 123456))
263+
new IngestStats.PipelineStat(
264+
ProjectId.DEFAULT,
265+
"pipeline1",
266+
new IngestStats.Stats(10, 1, 6, 2),
267+
new IngestStats.ByteStats(6467, 123456)
268+
)
234269
),
235-
Collections.singletonMap(
236-
"pipeline1",
237-
Arrays.asList(
238-
new IngestStats.ProcessorStat("inference", "inference", new IngestStats.Stats(120, 12, 0, 1)),
239-
new IngestStats.ProcessorStat("grok", "grok", new IngestStats.Stats(10, 1, 0, 0))
270+
Map.of(
271+
ProjectId.DEFAULT,
272+
Collections.singletonMap(
273+
"pipeline1",
274+
Arrays.asList(
275+
new IngestStats.ProcessorStat("inference", "inference", new IngestStats.Stats(120, 12, 0, 1)),
276+
new IngestStats.ProcessorStat("grok", "grok", new IngestStats.Stats(10, 1, 0, 0))
277+
)
240278
)
241279
)
242280
);
243281

244282
IngestStats expectedStatsModel2 = new IngestStats(
245283
new IngestStats.Stats(12, 3, 6, 4),
246284
Arrays.asList(
247-
new IngestStats.PipelineStat("pipeline1", new IngestStats.Stats(10, 1, 6, 2), new IngestStats.ByteStats(6467, 123456)),
248-
new IngestStats.PipelineStat("pipeline2", new IngestStats.Stats(2, 2, 0, 2), new IngestStats.ByteStats(234, 345))
285+
new IngestStats.PipelineStat(
286+
ProjectId.DEFAULT,
287+
"pipeline1",
288+
new IngestStats.Stats(10, 1, 6, 2),
289+
new IngestStats.ByteStats(6467, 123456)
290+
),
291+
new IngestStats.PipelineStat(
292+
ProjectId.DEFAULT,
293+
"pipeline2",
294+
new IngestStats.Stats(2, 2, 0, 2),
295+
new IngestStats.ByteStats(234, 345)
296+
)
249297
),
250-
new HashMap<>() {
298+
Map.of(ProjectId.DEFAULT, new HashMap<>() {
251299
{
252300
put(
253301
"pipeline2",
@@ -264,7 +312,7 @@ public void testInferenceIngestStatsByModelId() {
264312
)
265313
);
266314
}
267-
}
315+
})
268316
);
269317

270318
assertThat(ingestStatsMap, hasEntry("trained_model_1", expectedStatsModel1));
@@ -280,7 +328,10 @@ private static NodeStats buildNodeStats(
280328
IngestStats ingestStats = new IngestStats(
281329
overallStats,
282330
pipelineNames,
283-
IntStream.range(0, pipelineids.size()).boxed().collect(Collectors.toMap(pipelineids::get, processorStats::get))
331+
Map.of(
332+
ProjectId.DEFAULT,
333+
IntStream.range(0, pipelineids.size()).boxed().collect(Collectors.toMap(pipelineids::get, processorStats::get))
334+
)
284335
);
285336
return new NodeStats(
286337
mock(DiscoveryNode.class),

0 commit comments

Comments
 (0)