Merge pull request #7304 from unclejack/refactor_build_tests
integration cli: minor refactor of the build tests Upstream-commit: b36f6308176ccb44d93704388514fa0041a8584e Component: engine
This commit is contained in:
@ -88,12 +88,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)
|
||||
|
||||
Reference in New Issue
Block a user