mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
use of checkers on docker_cli_diff_test.go
Signed-off-by: weiyan <weiyan3@huawei.com>
This commit is contained in:
parent
7a19164c17
commit
7be79767c1
1 changed files with 6 additions and 11 deletions
|
@ -3,6 +3,7 @@ package main
|
||||||
import (
|
import (
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
"github.com/docker/docker/pkg/integration/checker"
|
||||||
"github.com/go-check/check"
|
"github.com/go-check/check"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -22,9 +23,7 @@ func (s *DockerSuite) TestDiffFilenameShownInOutput(c *check.C) {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if !found {
|
c.Assert(found, checker.True)
|
||||||
c.Errorf("couldn't find the new file in docker diff's output: %v", out)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// test to ensure GH #3840 doesn't occur any more
|
// test to ensure GH #3840 doesn't occur any more
|
||||||
|
@ -43,9 +42,7 @@ func (s *DockerSuite) TestDiffEnsureDockerinitFilesAreIgnored(c *check.C) {
|
||||||
out, _ = dockerCmd(c, "diff", cleanCID)
|
out, _ = dockerCmd(c, "diff", cleanCID)
|
||||||
|
|
||||||
for _, filename := range dockerinitFiles {
|
for _, filename := range dockerinitFiles {
|
||||||
if strings.Contains(out, filename) {
|
c.Assert(out, checker.Not(checker.Contains), filename)
|
||||||
c.Errorf("found file which should've been ignored %v in diff output", filename)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -78,15 +75,13 @@ func (s *DockerSuite) TestDiffEnsureOnlyKmsgAndPtmx(c *check.C) {
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, line := range strings.Split(out, "\n") {
|
for _, line := range strings.Split(out, "\n") {
|
||||||
if line != "" && !expected[line] {
|
c.Assert(line == "" || expected[line], checker.True)
|
||||||
c.Errorf("%q is shown in the diff but shouldn't", line)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://github.com/docker/docker/pull/14381#discussion_r33859347
|
// https://github.com/docker/docker/pull/14381#discussion_r33859347
|
||||||
func (s *DockerSuite) TestDiffEmptyArgClientError(c *check.C) {
|
func (s *DockerSuite) TestDiffEmptyArgClientError(c *check.C) {
|
||||||
out, _, err := dockerCmdWithError("diff", "")
|
out, _, err := dockerCmdWithError("diff", "")
|
||||||
c.Assert(err, check.NotNil)
|
c.Assert(err, checker.NotNil)
|
||||||
c.Assert(strings.TrimSpace(out), check.Equals, "Container name cannot be empty")
|
c.Assert(strings.TrimSpace(out), checker.Equals, "Container name cannot be empty")
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue