mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
integcli: add some more docker utils
Docker-DCO-1.1-Signed-off-by: Cristian Staretu <cristian.staretu@gmail.com> (github: unclejack)
This commit is contained in:
parent
487a417d9f
commit
f60c8e9e61
1 changed files with 14 additions and 0 deletions
|
@ -87,12 +87,26 @@ func pullImageIfNotExist(image string) (err error) {
|
|||
return
|
||||
}
|
||||
|
||||
// deprecated, use dockerCmd instead
|
||||
func cmd(t *testing.T, args ...string) (string, int, error) {
|
||||
return dockerCmd(t, args...)
|
||||
}
|
||||
|
||||
func dockerCmd(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))
|
||||
return out, status, err
|
||||
}
|
||||
|
||||
// execute a docker command in a directory
|
||||
func dockerCmdInDir(t *testing.T, path string, args ...string) (string, int, error) {
|
||||
dockerCommand := exec.Command(dockerBinary, args...)
|
||||
dockerCommand.Dir = path
|
||||
out, status, err := runCommandWithOutput(dockerCommand)
|
||||
errorOut(err, t, fmt.Sprintf("'%s' failed with errors: %v (%v)", strings.Join(args, " "), err, out))
|
||||
return out, status, err
|
||||
}
|
||||
|
||||
func findContainerIp(t *testing.T, id string) string {
|
||||
cmd := exec.Command(dockerBinary, "inspect", "--format='{{ .NetworkSettings.IPAddress }}'", id)
|
||||
out, _, err := runCommandWithOutput(cmd)
|
||||
|
|
Loading…
Add table
Reference in a new issue