mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
integcli: add & use pullImageIfNotExist for pulls
This speeds up the tag cli integration tests by about 20 seconds. Docker-DCO-1.1-Signed-off-by: Cristian Staretu <cristian.staretu@gmail.com> (github: unclejack)
This commit is contained in:
parent
63e28cc363
commit
dad4768037
2 changed files with 19 additions and 15 deletions
|
@ -75,6 +75,18 @@ func imageExists(image string) error {
|
|||
return err
|
||||
}
|
||||
|
||||
func pullImageIfNotExist(image string) (err error) {
|
||||
if err := imageExists(image); err != nil {
|
||||
pullCmd := exec.Command(dockerBinary, "pull", image)
|
||||
_, exitCode, err := runCommandWithOutput(pullCmd)
|
||||
|
||||
if err != nil || exitCode != 0 {
|
||||
err = fmt.Errorf("image '%s' wasn't found locally and it couldn't be pulled: %s", image, err)
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func cmd(t *testing.T, args ...string) (string, int, error) {
|
||||
out, status, err := runCommandWithOutput(exec.Command(dockerBinary, args...))
|
||||
errorOut(err, t, fmt.Sprintf("'%s' failed with errors: %v (%v)", strings.Join(args, " "), err, out))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue