Checkers on docker_cli_pull_local_test.go

Applying #16756 to integration-cli/docker_cli_pull_local_test.go

Signed-off-by: Aditi Rajagopal <arajagopal@us.ibm.com>
This commit is contained in:
Aditi Rajagopal 2015-11-24 12:47:35 -05:00
parent 8e144e6c50
commit bc2682badc
1 changed files with 9 additions and 8 deletions

View File

@ -5,6 +5,7 @@ import (
"os/exec" "os/exec"
"strings" "strings"
"github.com/docker/docker/pkg/integration/checker"
"github.com/go-check/check" "github.com/go-check/check"
) )
@ -35,7 +36,7 @@ func (s *DockerRegistrySuite) TestPullImageWithAliases(c *check.C) {
dockerCmd(c, "inspect", repos[0]) dockerCmd(c, "inspect", repos[0])
for _, repo := range repos[1:] { for _, repo := range repos[1:] {
_, _, err := dockerCmdWithError("inspect", repo) _, _, err := dockerCmdWithError("inspect", repo)
c.Assert(err, check.NotNil, check.Commentf("Image %v shouldn't have been pulled down", repo)) c.Assert(err, checker.NotNil, check.Commentf("Image %v shouldn't have been pulled down", repo))
} }
} }
@ -53,7 +54,7 @@ func (s *DockerRegistrySuite) TestConcurrentPullWholeRepo(c *check.C) {
ENV BAR bar ENV BAR bar
CMD echo %s CMD echo %s
`, repo), true) `, repo), true)
c.Assert(err, check.IsNil) c.Assert(err, checker.IsNil)
dockerCmd(c, "push", repo) dockerCmd(c, "push", repo)
repos = append(repos, repo) repos = append(repos, repo)
} }
@ -77,14 +78,14 @@ func (s *DockerRegistrySuite) TestConcurrentPullWholeRepo(c *check.C) {
// package is not goroutine-safe. // package is not goroutine-safe.
for i := 0; i != numPulls; i++ { for i := 0; i != numPulls; i++ {
err := <-results err := <-results
c.Assert(err, check.IsNil, check.Commentf("concurrent pull failed with error: %v", err)) c.Assert(err, checker.IsNil, check.Commentf("concurrent pull failed with error: %v", err))
} }
// Ensure all tags were pulled successfully // Ensure all tags were pulled successfully
for _, repo := range repos { for _, repo := range repos {
dockerCmd(c, "inspect", repo) dockerCmd(c, "inspect", repo)
out, _ := dockerCmd(c, "run", "--rm", repo) out, _ := dockerCmd(c, "run", "--rm", repo)
c.Assert(strings.TrimSpace(out), check.Equals, "/bin/sh -c echo "+repo, check.Commentf("CMD did not contain /bin/sh -c echo %s: %s", repo, out)) c.Assert(strings.TrimSpace(out), checker.Equals, "/bin/sh -c echo "+repo, check.Commentf("CMD did not contain /bin/sh -c echo %s: %s", repo, out))
} }
} }
@ -107,7 +108,7 @@ func (s *DockerRegistrySuite) TestConcurrentFailingPull(c *check.C) {
// package is not goroutine-safe. // package is not goroutine-safe.
for i := 0; i != numPulls; i++ { for i := 0; i != numPulls; i++ {
err := <-results err := <-results
c.Assert(err, check.NotNil, check.Commentf("expected pull to fail")) c.Assert(err, checker.NotNil, check.Commentf("expected pull to fail"))
} }
} }
@ -126,7 +127,7 @@ func (s *DockerRegistrySuite) TestConcurrentPullMultipleTags(c *check.C) {
ENV BAR bar ENV BAR bar
CMD echo %s CMD echo %s
`, repo), true) `, repo), true)
c.Assert(err, check.IsNil) c.Assert(err, checker.IsNil)
dockerCmd(c, "push", repo) dockerCmd(c, "push", repo)
repos = append(repos, repo) repos = append(repos, repo)
} }
@ -149,13 +150,13 @@ func (s *DockerRegistrySuite) TestConcurrentPullMultipleTags(c *check.C) {
// package is not goroutine-safe. // package is not goroutine-safe.
for range repos { for range repos {
err := <-results err := <-results
c.Assert(err, check.IsNil, check.Commentf("concurrent pull failed with error: %v", err)) c.Assert(err, checker.IsNil, check.Commentf("concurrent pull failed with error: %v", err))
} }
// Ensure all tags were pulled successfully // Ensure all tags were pulled successfully
for _, repo := range repos { for _, repo := range repos {
dockerCmd(c, "inspect", repo) dockerCmd(c, "inspect", repo)
out, _ := dockerCmd(c, "run", "--rm", repo) out, _ := dockerCmd(c, "run", "--rm", repo)
c.Assert(strings.TrimSpace(out), check.Equals, "/bin/sh -c echo "+repo, check.Commentf("CMD did not contain /bin/sh -c echo %s; %s", repo, out)) c.Assert(strings.TrimSpace(out), checker.Equals, "/bin/sh -c echo "+repo, check.Commentf("CMD did not contain /bin/sh -c echo %s; %s", repo, out))
} }
} }