mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Merge pull request #43733 from thaJeztah/fix_flaky_TestRunContainerWithRmFlag
fix flaky TestRunContainerWithRmFlag tests (take 2)
This commit is contained in:
commit
c17a566b0d
1 changed files with 17 additions and 10 deletions
|
@ -34,6 +34,7 @@ import (
|
|||
"github.com/moby/sys/mountinfo"
|
||||
"gotest.tools/v3/assert"
|
||||
"gotest.tools/v3/icmd"
|
||||
"gotest.tools/v3/poll"
|
||||
"gotest.tools/v3/skip"
|
||||
)
|
||||
|
||||
|
@ -2750,11 +2751,7 @@ func (s *DockerSuite) TestRunContainerWithRmFlagExitCodeNotEqualToZero(c *testin
|
|||
ExitCode: 1,
|
||||
})
|
||||
|
||||
cli.Docker(cli.Args("container", "inspect", name)).Assert(c, icmd.Expected{
|
||||
ExitCode: 1,
|
||||
Out: "[]\n",
|
||||
Err: "o such container", // (N|n)o such container
|
||||
})
|
||||
poll.WaitOn(c, containerRemoved(name))
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestRunContainerWithRmFlagCannotStartContainer(c *testing.T) {
|
||||
|
@ -2763,11 +2760,21 @@ func (s *DockerSuite) TestRunContainerWithRmFlagCannotStartContainer(c *testing.
|
|||
ExitCode: 127,
|
||||
})
|
||||
|
||||
cli.Docker(cli.Args("container", "inspect", name)).Assert(c, icmd.Expected{
|
||||
ExitCode: 1,
|
||||
Out: "[]\n",
|
||||
Err: "o such container", // (N|n)o such container
|
||||
})
|
||||
poll.WaitOn(c, containerRemoved(name))
|
||||
}
|
||||
|
||||
func containerRemoved(name string) poll.Check {
|
||||
return func(l poll.LogT) poll.Result {
|
||||
err := cli.Docker(cli.Args("container", "inspect", "--format='{{.ID}}'", name)).Compare(icmd.Expected{
|
||||
ExitCode: 1,
|
||||
Out: "",
|
||||
Err: "o such container", // (N|n)o such container
|
||||
})
|
||||
if err != nil {
|
||||
return poll.Continue("waiting for container '%s' to be removed", name)
|
||||
}
|
||||
return poll.Success()
|
||||
}
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestRunPIDHostWithChildIsKillable(c *testing.T) {
|
||||
|
|
Loading…
Add table
Reference in a new issue