(t *testing.T, containerEventsChans []chan *runtime.ContainerEventResponse, expectedType runtime.ContainerEventType, expectedPodSandboxStatus *runtime.PodSandboxStatus, expectedContainerStates []runtime.ContainerState)
| 141 | } |
| 142 | |
| 143 | func 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 | } |
no test coverage detected
searching dependent graphs…