Signed-off-by: weiyan <weiyan3@huawei.com>
| ... | ... |
@@ -3,6 +3,7 @@ package main |
| 3 | 3 |
import ( |
| 4 | 4 |
"strings" |
| 5 | 5 |
|
| 6 |
+ "github.com/docker/docker/pkg/integration/checker" |
|
| 6 | 7 |
"github.com/go-check/check" |
| 7 | 8 |
) |
| 8 | 9 |
|
| ... | ... |
@@ -22,9 +23,7 @@ func (s *DockerSuite) TestDiffFilenameShownInOutput(c *check.C) {
|
| 22 | 22 |
break |
| 23 | 23 |
} |
| 24 | 24 |
} |
| 25 |
- if !found {
|
|
| 26 |
- c.Errorf("couldn't find the new file in docker diff's output: %v", out)
|
|
| 27 |
- } |
|
| 25 |
+ c.Assert(found, checker.True) |
|
| 28 | 26 |
} |
| 29 | 27 |
|
| 30 | 28 |
// test to ensure GH #3840 doesn't occur any more |
| ... | ... |
@@ -43,9 +42,7 @@ func (s *DockerSuite) TestDiffEnsureDockerinitFilesAreIgnored(c *check.C) {
|
| 43 | 43 |
out, _ = dockerCmd(c, "diff", cleanCID) |
| 44 | 44 |
|
| 45 | 45 |
for _, filename := range dockerinitFiles {
|
| 46 |
- if strings.Contains(out, filename) {
|
|
| 47 |
- c.Errorf("found file which should've been ignored %v in diff output", filename)
|
|
| 48 |
- } |
|
| 46 |
+ c.Assert(out, checker.Not(checker.Contains), filename) |
|
| 49 | 47 |
} |
| 50 | 48 |
} |
| 51 | 49 |
} |
| ... | ... |
@@ -78,15 +75,13 @@ func (s *DockerSuite) TestDiffEnsureOnlyKmsgAndPtmx(c *check.C) {
|
| 78 | 78 |
} |
| 79 | 79 |
|
| 80 | 80 |
for _, line := range strings.Split(out, "\n") {
|
| 81 |
- if line != "" && !expected[line] {
|
|
| 82 |
- c.Errorf("%q is shown in the diff but shouldn't", line)
|
|
| 83 |
- } |
|
| 81 |
+ c.Assert(line == "" || expected[line], checker.True) |
|
| 84 | 82 |
} |
| 85 | 83 |
} |
| 86 | 84 |
|
| 87 | 85 |
// https://github.com/docker/docker/pull/14381#discussion_r33859347 |
| 88 | 86 |
func (s *DockerSuite) TestDiffEmptyArgClientError(c *check.C) {
|
| 89 | 87 |
out, _, err := dockerCmdWithError("diff", "")
|
| 90 |
- c.Assert(err, check.NotNil) |
|
| 91 |
- c.Assert(strings.TrimSpace(out), check.Equals, "Container name cannot be empty") |
|
| 88 |
+ c.Assert(err, checker.NotNil) |
|
| 89 |
+ c.Assert(strings.TrimSpace(out), checker.Equals, "Container name cannot be empty") |
|
| 92 | 90 |
} |