MCPcopy Index your code
hub / github.com/containerd/containerd / checkContainerEventResponse

Function checkContainerEventResponse

integration/container_event_test.go:143–166  ·  view source on GitHub ↗
(t *testing.T, containerEventsChans []chan *runtime.ContainerEventResponse, expectedType runtime.ContainerEventType, expectedPodSandboxStatus *runtime.PodSandboxStatus, expectedContainerStates []runtime.ContainerState)

Source from the content-addressed store, hash-verified

141}
142
143func checkContainerEventResponse(t *testing.T, containerEventsChans []chan *runtime.ContainerEventResponse, expectedType runtime.ContainerEventType, expectedPodSandboxStatus *runtime.PodSandboxStatus, expectedContainerStates []runtime.ContainerState) {
144 t.Helper()
145 for _, ch := range containerEventsChans {
146 var resp *runtime.ContainerEventResponse
147 select {
148 case resp = <-ch:
149 case <-time.After(readContainerEventChannelTimeout):
150 t.Fatal("assertContainerEventResponse: timeout waiting for events from channel")
151 }
152 require.NotNil(t, resp)
153 t.Logf("Container Event response received: %+v", resp)
154 assert.Equal(t, expectedType, resp.ContainerEventType)
155
156 // Checking only the State field of PodSandboxStatus
157 if expectedPodSandboxStatus != nil {
158 assert.Equal(t, expectedPodSandboxStatus.State, resp.PodSandboxStatus.State)
159 }
160
161 // Checking only the State field of ContainersStatus
162 for i, cs := range resp.ContainersStatuses {
163 assert.Equal(t, expectedContainerStates[i], cs.State)
164 }
165 }
166}

Callers 1

TestContainerEventsFunction · 0.85

Calls 1

FatalMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…