浏览代码

Fix docker import tests

For me when I run the test I see:
```
Downloading from http://nourl/bad
Importing    283 B
Untar re-exec error: exit status 1: output: unexpected EOF
```
and nothing about "dial tcp" so it appears that the output is
system dependent and therefore we can't really check it. I think
checking for non-zero exit code is sufficient so I'm removing this
string check.

Signed-off-by: Doug Davis <dug@us.ibm.com>
Doug Davis 9 年之前
父节点
当前提交
ac043c7db6
共有 2 个文件被更改,包括 6 次插入2 次删除
  1. 5 1
      integration-cli/docker_cli_import_test.go
  2. 1 1
      pkg/chrootarchive/archive_unix.go

+ 5 - 1
integration-cli/docker_cli_import_test.go

@@ -35,7 +35,11 @@ func (s *DockerSuite) TestImportBadURL(c *check.C) {
 	testRequires(c, DaemonIsLinux)
 	out, _, err := dockerCmdWithError("import", "http://nourl/bad")
 	c.Assert(err, checker.NotNil, check.Commentf("import was supposed to fail but didn't"))
-	c.Assert(out, checker.Contains, "dial tcp", check.Commentf("expected an error msg but didn't get one"))
+	// Depending on your system you can get either of these errors
+	if !strings.Contains(out, "dial tcp") &&
+		!strings.Contains(out, "Error processing tar file") {
+		c.Fatalf("expected an error msg but didn't get one.\nErr: %v\nOut: %v", err, out)
+	}
 }
 
 func (s *DockerSuite) TestImportFile(c *check.C) {

+ 1 - 1
pkg/chrootarchive/archive_unix.go

@@ -80,7 +80,7 @@ func invokeUnpack(decompressedArchive io.Reader, dest string, options *archive.T
 		// pending on write pipe forever
 		io.Copy(ioutil.Discard, decompressedArchive)
 
-		return fmt.Errorf("Untar re-exec error: %v: output: %s", err, output)
+		return fmt.Errorf("Error processing tar file(%v): %s", err, output)
 	}
 	return nil
 }