mirror of
https://github.com/moby/moby.git
synced 2025-07-30 18:23:29 +03:00
fix some ineffectual assignments
to make goreportcard a bit happier
https://goreportcard.com/report/github.com/docker/docker
also found that `TestCpToErrDstParentNotExists()` was
partially broken, because a `runDockerCp()` was inadvertently
removed in f26a31e80c
`TestDaemonRestartSaveContainerExitCode()` didn't verify
the actual _Error_ message, so added that to the test,
and updated the test to take into account that the
"experimental" CI enables `--init` on containers.
`TestVolumeCLICreateOptionConflict()` only checked
for an error to occur, but didn't validate if the
error was due to conflicting options.
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
@ -2566,7 +2566,14 @@ func (s *DockerDaemonSuite) TestDaemonRestartSaveContainerExitCode(c *check.C) {
|
||||
|
||||
containerName := "error-values"
|
||||
// Make a container with both a non 0 exit code and an error message
|
||||
out, err := s.d.Cmd("run", "--name", containerName, "busybox", "toto")
|
||||
// We explicitly disable `--init` for this test, because `--init` is enabled by default
|
||||
// on "experimental". Enabling `--init` results in a different behavior; because the "init"
|
||||
// process itself is PID1, the container does not fail on _startup_ (i.e., `docker-init` starting),
|
||||
// but directly after. The exit code of the container is still 127, but the Error Message is not
|
||||
// captured, so `.State.Error` is empty.
|
||||
// See the discussion on https://github.com/docker/docker/pull/30227#issuecomment-274161426,
|
||||
// and https://github.com/docker/docker/pull/26061#r78054578 for more information.
|
||||
out, err := s.d.Cmd("run", "--name", containerName, "--init=false", "busybox", "toto")
|
||||
c.Assert(err, checker.NotNil)
|
||||
|
||||
// Check that those values were saved on disk
|
||||
@ -2575,9 +2582,10 @@ func (s *DockerDaemonSuite) TestDaemonRestartSaveContainerExitCode(c *check.C) {
|
||||
c.Assert(err, checker.IsNil)
|
||||
c.Assert(out, checker.Equals, "127")
|
||||
|
||||
out, err = s.d.Cmd("inspect", "-f", "{{.State.Error}}", containerName)
|
||||
out = strings.TrimSpace(out)
|
||||
errMsg1, err := s.d.Cmd("inspect", "-f", "{{.State.Error}}", containerName)
|
||||
errMsg1 = strings.TrimSpace(errMsg1)
|
||||
c.Assert(err, checker.IsNil)
|
||||
c.Assert(errMsg1, checker.Contains, "executable file not found")
|
||||
|
||||
// now restart daemon
|
||||
s.d.Restart(c)
|
||||
@ -2591,6 +2599,7 @@ func (s *DockerDaemonSuite) TestDaemonRestartSaveContainerExitCode(c *check.C) {
|
||||
out, err = s.d.Cmd("inspect", "-f", "{{.State.Error}}", containerName)
|
||||
out = strings.TrimSpace(out)
|
||||
c.Assert(err, checker.IsNil)
|
||||
c.Assert(out, checker.Equals, errMsg1)
|
||||
}
|
||||
|
||||
func (s *DockerDaemonSuite) TestDaemonBackcompatPre17Volumes(c *check.C) {
|
||||
|
Reference in New Issue
Block a user