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:
Sebastiaan van Stijn
2017-01-18 03:08:31 +01:00
parent 8820266c17
commit ba0afd70e8
13 changed files with 38 additions and 19 deletions

View File

@@ -442,6 +442,7 @@ func (s *DockerSuite) TestCpSpecialFiles(c *check.C) {
expected, err = readContainerFile(containerID, "hostname")
actual, err = ioutil.ReadFile(outDir + "/hostname")
c.Assert(err, checker.IsNil)
// Expected copied file to be duplicate of the container resolvconf
c.Assert(bytes.Equal(actual, expected), checker.True)
@@ -534,6 +535,7 @@ func (s *DockerSuite) TestCpToDot(c *check.C) {
c.Assert(os.Chdir(tmpdir), checker.IsNil)
dockerCmd(c, "cp", containerID+":/test", ".")
content, err := ioutil.ReadFile("./test")
c.Assert(err, checker.IsNil)
c.Assert(string(content), checker.Equals, "lololol\n")
}
@@ -572,6 +574,7 @@ func (s *DockerSuite) TestCpNameHasColon(c *check.C) {
defer os.RemoveAll(tmpdir)
dockerCmd(c, "cp", containerID+":/te:s:t", tmpdir)
content, err := ioutil.ReadFile(tmpdir + "/te:s:t")
c.Assert(err, checker.IsNil)
c.Assert(string(content), checker.Equals, "lololol\n")
}
@@ -653,6 +656,7 @@ func (s *DockerSuite) TestCpSymlinkFromConToHostFollowSymlink(c *check.C) {
dockerCmd(c, "cp", "-L", cleanedContainerID+":"+"/dir_link", expectedPath)
actual, err = ioutil.ReadFile(expectedPath)
c.Assert(err, checker.IsNil)
if !bytes.Equal(actual, expected) {
c.Fatalf("Expected copied file to be duplicate of the container symbol link target")