Unverified Commit 60a4c3c0 authored by Kubernetes Prow Robot's avatar Kubernetes Prow Robot Committed by GitHub

Merge pull request #76603 from changyaowei/generic_ut_fix

fix TestEventChannelFull random fail
parents 71bbabc3 850f4bbd
...@@ -211,15 +211,17 @@ func TestEventChannelFull(t *testing.T) { ...@@ -211,15 +211,17 @@ func TestEventChannelFull(t *testing.T) {
}}, }},
} }
pleg.relist() pleg.relist()
// event channel is full, discard events allEvents := []*PodLifecycleEvent{
expected = []*PodLifecycleEvent{
{ID: "1234", Type: ContainerRemoved, Data: "c1"}, {ID: "1234", Type: ContainerRemoved, Data: "c1"},
{ID: "1234", Type: ContainerDied, Data: "c2"}, {ID: "1234", Type: ContainerDied, Data: "c2"},
{ID: "1234", Type: ContainerStarted, Data: "c3"}, {ID: "1234", Type: ContainerStarted, Data: "c3"},
{ID: "4567", Type: ContainerRemoved, Data: "c1"}, {ID: "4567", Type: ContainerRemoved, Data: "c1"},
{ID: "4567", Type: ContainerStarted, Data: "c4"},
} }
// event channel is full, discard events
actual = getEventsFromChannel(ch) actual = getEventsFromChannel(ch)
verifyEvents(t, expected, actual) assert.True(t, len(actual) == 4, "channel length should be 4")
assert.Subsetf(t, allEvents, actual, "actual events should in all events")
} }
func TestDetectingContainerDeaths(t *testing.T) { func TestDetectingContainerDeaths(t *testing.T) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment