Skip to content

Commit 6d0f474

Browse files
authored
Merge pull request kubernetes#94185 from knight42/fix/TestRemoveContainer
test(kuberuntime): deflake TestRemoveContainer
2 parents 3229073 + cfeddcf commit 6d0f474

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

pkg/kubelet/kuberuntime/kuberuntime_container_test.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,12 @@ func TestRemoveContainer(t *testing.T) {
7979

8080
err = m.removeContainer(containerID)
8181
assert.NoError(t, err)
82-
// Verify container log is removed
8382

84-
assert.Equal(t, []string{expectedContainerLogPath, expectedContainerLogPathRotated, expectedContainerLogSymlink}, fakeOS.Removes)
83+
// Verify container log is removed.
84+
// We could not predict the order of `fakeOS.Removes`, so we use `assert.ElementsMatch` here.
85+
assert.ElementsMatch(t,
86+
[]string{expectedContainerLogSymlink, expectedContainerLogPath, expectedContainerLogPathRotated},
87+
fakeOS.Removes)
8588
// Verify container is removed
8689
assert.Contains(t, fakeRuntime.Called, "RemoveContainer")
8790
containers, err := fakeRuntime.ListContainers(&runtimeapi.ContainerFilter{Id: containerID})

0 commit comments

Comments
 (0)