mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-19 08:40:42 +00:00
Merge pull request #94185 from knight42/fix/TestRemoveContainer
test(kuberuntime): deflake TestRemoveContainer
This commit is contained in:
commit
6d0f4749a5
@ -79,9 +79,12 @@ func TestRemoveContainer(t *testing.T) {
|
|||||||
|
|
||||||
err = m.removeContainer(containerID)
|
err = m.removeContainer(containerID)
|
||||||
assert.NoError(t, err)
|
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
|
// Verify container is removed
|
||||||
assert.Contains(t, fakeRuntime.Called, "RemoveContainer")
|
assert.Contains(t, fakeRuntime.Called, "RemoveContainer")
|
||||||
containers, err := fakeRuntime.ListContainers(&runtimeapi.ContainerFilter{Id: containerID})
|
containers, err := fakeRuntime.ListContainers(&runtimeapi.ContainerFilter{Id: containerID})
|
||||||
|
Loading…
Reference in New Issue
Block a user