Skip to content

Commit 9b1fb0d

Browse files
committed
Merge pull request moby#16871 from ZJU-SEL/fix_version_test
update docker_cli_version_test.go
2 parents ab1f033 + d4d0718 commit 9b1fb0d

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

integration-cli/docker_cli_version_test.go

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package main
33
import (
44
"strings"
55

6+
"github.com/docker/docker/pkg/integration/checker"
67
"github.com/go-check/check"
78
)
89

@@ -21,9 +22,7 @@ func (s *DockerSuite) TestVersionEnsureSucceeds(c *check.C) {
2122
}
2223

2324
for k, v := range stringsToCheck {
24-
if strings.Count(out, k) != v {
25-
c.Errorf("%v expected %d instances found %d", k, v, strings.Count(out, k))
26-
}
25+
c.Assert(strings.Count(out, k), checker.Equals, v, check.Commentf("The count of %v in %s does not match excepted", k, out))
2726
}
2827
}
2928

@@ -44,9 +43,7 @@ func testVersionPlatform(c *check.C, platform string) {
4443
expected := "OS/Arch: " + platform
4544

4645
split := strings.Split(out, "\n")
47-
if len(split) < 14 { // To avoid invalid indexing in loop below
48-
c.Errorf("got %d lines from version", len(split))
49-
}
46+
c.Assert(len(split) >= 14, checker.Equals, true, check.Commentf("got %d lines from version", len(split)))
5047

5148
// Verify the second 'OS/Arch' matches the platform. Experimental has
5249
// more lines of output than 'regular'
@@ -57,7 +54,5 @@ func testVersionPlatform(c *check.C, platform string) {
5754
break
5855
}
5956
}
60-
if !bFound {
61-
c.Errorf("Could not find server '%s' in '%s'", expected, out)
62-
}
57+
c.Assert(bFound, checker.Equals, true, check.Commentf("Could not find server '%s' in '%s'", expected, out))
6358
}

0 commit comments

Comments
 (0)