From 7be79767c18a1643e9e8e9be1764f2c838152c0b Mon Sep 17 00:00:00 2001 From: weiyan Date: Mon, 19 Oct 2015 17:31:02 +0800 Subject: [PATCH] use of checkers on docker_cli_diff_test.go Signed-off-by: weiyan --- integration-cli/docker_cli_diff_test.go | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/integration-cli/docker_cli_diff_test.go b/integration-cli/docker_cli_diff_test.go index 42f1d89fb1..52209e602b 100644 --- a/integration-cli/docker_cli_diff_test.go +++ b/integration-cli/docker_cli_diff_test.go @@ -3,6 +3,7 @@ package main import ( "strings" + "github.com/docker/docker/pkg/integration/checker" "github.com/go-check/check" ) @@ -22,9 +23,7 @@ func (s *DockerSuite) TestDiffFilenameShownInOutput(c *check.C) { break } } - if !found { - c.Errorf("couldn't find the new file in docker diff's output: %v", out) - } + c.Assert(found, checker.True) } // 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) for _, filename := range dockerinitFiles { - if strings.Contains(out, filename) { - c.Errorf("found file which should've been ignored %v in diff output", filename) - } + c.Assert(out, checker.Not(checker.Contains), filename) } } } @@ -78,15 +75,13 @@ func (s *DockerSuite) TestDiffEnsureOnlyKmsgAndPtmx(c *check.C) { } for _, line := range strings.Split(out, "\n") { - if line != "" && !expected[line] { - c.Errorf("%q is shown in the diff but shouldn't", line) - } + c.Assert(line == "" || expected[line], checker.True) } } // https://github.com/docker/docker/pull/14381#discussion_r33859347 func (s *DockerSuite) TestDiffEmptyArgClientError(c *check.C) { out, _, err := dockerCmdWithError("diff", "") - c.Assert(err, check.NotNil) - c.Assert(strings.TrimSpace(out), check.Equals, "Container name cannot be empty") + c.Assert(err, checker.NotNil) + c.Assert(strings.TrimSpace(out), checker.Equals, "Container name cannot be empty") }