@@ -211,23 +211,17 @@ func TestEventChannelFull(t *testing.T) {
211
211
}},
212
212
}
213
213
pleg .relist ()
214
- // event channel is full, discard events
215
- expected = []* PodLifecycleEvent {
214
+ allEvents := []* PodLifecycleEvent {
216
215
{ID : "1234" , Type : ContainerRemoved , Data : "c1" },
217
216
{ID : "1234" , Type : ContainerDied , Data : "c2" },
218
217
{ID : "1234" , Type : ContainerStarted , Data : "c3" },
219
218
{ID : "4567" , Type : ContainerRemoved , Data : "c1" },
220
219
{ID : "4567" , Type : ContainerStarted , Data : "c4" },
221
220
}
221
+ // event channel is full, discard events
222
222
actual = getEventsFromChannel (ch )
223
223
assert .True (t , len (actual ) == 4 , "channel length should be 4" )
224
- for _ , actualEvent := range actual {
225
- for _ , expectedEvent := range expected {
226
- if actualEvent .ID == expectedEvent .ID && actualEvent .Data == expectedEvent .Data {
227
- assert .True (t , actualEvent .Type == expectedEvent .Type , "event type should be equal" )
228
- }
229
- }
230
- }
224
+ assert .Subsetf (t , allEvents , actual , "actual events should in all events" )
231
225
}
232
226
233
227
func TestDetectingContainerDeaths (t * testing.T ) {
0 commit comments