Skip to content

Commit e643810

Browse files
committed
fix listCoontainerStats not filter
Signed-off-by: lengrongfu <[email protected]>
1 parent e6a1f68 commit e643810

File tree

1 file changed

+19
-5
lines changed

1 file changed

+19
-5
lines changed

pkg/validate/container.go

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -214,9 +214,12 @@ var _ = framework.KubeDescribe("Container", func() {
214214

215215
By("start container")
216216
startContainer(rc, containerID)
217+
filter := &runtimeapi.ContainerStatsFilter{
218+
Id: containerID,
219+
}
217220

218221
By("test container stats")
219-
stats := listContainerStats(rc, nil)
222+
stats := listContainerStats(rc, filter)
220223
Expect(statFound(stats, containerID)).To(BeTrue(), "Stats should be found")
221224
})
222225

@@ -236,10 +239,21 @@ var _ = framework.KubeDescribe("Container", func() {
236239
startContainer(rc, thirdContainerID)
237240

238241
By("test containers stats")
239-
stats := listContainerStats(rc, nil)
240-
Expect(statFound(stats, firstContainerID)).To(BeTrue(), "Stats should be found")
241-
Expect(statFound(stats, secondContainerID)).To(BeTrue(), "Stats should be found")
242-
Expect(statFound(stats, thirdContainerID)).To(BeTrue(), "Stats should be found")
242+
firstFilter := &runtimeapi.ContainerStatsFilter{
243+
Id: firstContainerID,
244+
}
245+
firstStats := listContainerStats(rc, firstFilter)
246+
secondFilter := &runtimeapi.ContainerStatsFilter{
247+
Id: secondContainerID,
248+
}
249+
secondStats := listContainerStats(rc, secondFilter)
250+
thirdFilter := &runtimeapi.ContainerStatsFilter{
251+
Id: thirdContainerID,
252+
}
253+
thirdStats := listContainerStats(rc, thirdFilter)
254+
Expect(statFound(firstStats, firstContainerID)).To(BeTrue(), "Stats should be found")
255+
Expect(statFound(secondStats, secondContainerID)).To(BeTrue(), "Stats should be found")
256+
Expect(statFound(thirdStats, thirdContainerID)).To(BeTrue(), "Stats should be found")
243257
})
244258
})
245259

0 commit comments

Comments
 (0)