Browse code

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 authored on 2016/05/24 02:00:01
Showing 2 changed files
... ...
@@ -35,7 +35,11 @@ func (s *DockerSuite) TestImportBadURL(c *check.C) {
35 35
 	testRequires(c, DaemonIsLinux)
36 36
 	out, _, err := dockerCmdWithError("import", "http://nourl/bad")
37 37
 	c.Assert(err, checker.NotNil, check.Commentf("import was supposed to fail but didn't"))
38
-	c.Assert(out, checker.Contains, "dial tcp", check.Commentf("expected an error msg but didn't get one"))
38
+	// Depending on your system you can get either of these errors
39
+	if !strings.Contains(out, "dial tcp") &&
40
+		!strings.Contains(out, "Error processing tar file") {
41
+		c.Fatalf("expected an error msg but didn't get one.\nErr: %v\nOut: %v", err, out)
42
+	}
39 43
 }
40 44
 
41 45
 func (s *DockerSuite) TestImportFile(c *check.C) {
... ...
@@ -80,7 +80,7 @@ func invokeUnpack(decompressedArchive io.Reader, dest string, options *archive.T
80 80
 		// pending on write pipe forever
81 81
 		io.Copy(ioutil.Discard, decompressedArchive)
82 82
 
83
-		return fmt.Errorf("Untar re-exec error: %v: output: %s", err, output)
83
+		return fmt.Errorf("Error processing tar file(%v): %s", err, output)
84 84
 	}
85 85
 	return nil
86 86
 }