Skip to content

Commit 60a4c3c

Browse files
authored
Merge pull request kubernetes#76603 from changyaowei/generic_ut_fix
fix TestEventChannelFull random fail
2 parents 71bbabc + 850f4bb commit 60a4c3c

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

pkg/kubelet/pleg/generic_test.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -211,15 +211,17 @@ func TestEventChannelFull(t *testing.T) {
211211
}},
212212
}
213213
pleg.relist()
214-
// event channel is full, discard events
215-
expected = []*PodLifecycleEvent{
214+
allEvents := []*PodLifecycleEvent{
216215
{ID: "1234", Type: ContainerRemoved, Data: "c1"},
217216
{ID: "1234", Type: ContainerDied, Data: "c2"},
218217
{ID: "1234", Type: ContainerStarted, Data: "c3"},
219218
{ID: "4567", Type: ContainerRemoved, Data: "c1"},
219+
{ID: "4567", Type: ContainerStarted, Data: "c4"},
220220
}
221+
// event channel is full, discard events
221222
actual = getEventsFromChannel(ch)
222-
verifyEvents(t, expected, actual)
223+
assert.True(t, len(actual) == 4, "channel length should be 4")
224+
assert.Subsetf(t, allEvents, actual, "actual events should in all events")
223225
}
224226

225227
func TestDetectingContainerDeaths(t *testing.T) {

0 commit comments

Comments
 (0)