Merge pull request #94185 from knight42/fix/TestRemoveContainer

test(kuberuntime): deflake TestRemoveContainer
This commit is contained in:
Kubernetes Prow Robot
2020-08-24 15:10:17 -07:00
committed by GitHub

View File

@@ -79,9 +79,12 @@ func TestRemoveContainer(t *testing.T) {
err = m.removeContainer(containerID)
assert.NoError(t, err)
// Verify container log is removed
assert.Equal(t, []string{expectedContainerLogPath, expectedContainerLogPathRotated, expectedContainerLogSymlink}, fakeOS.Removes)
// Verify container log is removed.
// We could not predict the order of `fakeOS.Removes`, so we use `assert.ElementsMatch` here.
assert.ElementsMatch(t,
[]string{expectedContainerLogSymlink, expectedContainerLogPath, expectedContainerLogPathRotated},
fakeOS.Removes)
// Verify container is removed
assert.Contains(t, fakeRuntime.Called, "RemoveContainer")
containers, err := fakeRuntime.ListContainers(&runtimeapi.ContainerFilter{Id: containerID})