Recfactor: Use dockerCmd when possible in integration-cli tests

Part of #14603
integration-cli/docker_cli_links_test.go (coolljt0725)
integration-cli/docker_cli_links_unix_test.go (coolljt0725)
integration-cli/docker_cli_logs_test.go (coolljt0725)
integration-cli/docker_cli_nat_test.go (coolljt0725)
integration-cli/docker_cli_network_test.go (coolljt0725)
integration-cli/docker_cli_stats_test.go (coolljt0725)
integration-cli/docker_cli_tag_test.go (coolljt0725)
integration-cli/docker_cli_top_test.go (coolljt0725)
integration-cli/docker_cli_version_test.go (coolljt0725)
integration-cli/docker_cli_wait_test.go (coolljt0725

Signed-off-by: Lei Jitang <leijitang@huawei.com>
This commit is contained in:
Lei
2015-07-20 14:44:22 +08:00
parent c6cde91b7d
commit eef6eda7d2
10 changed files with 96 additions and 372 deletions
+3 -10
View File
@@ -3,7 +3,6 @@
package main
import (
"os/exec"
"strings"
"github.com/go-check/check"
@@ -22,9 +21,7 @@ func assertNwNotAvailable(c *check.C, name string) {
}
func isNwPresent(c *check.C, name string) bool {
runCmd := exec.Command(dockerBinary, "network", "ls")
out, _, _, err := runCommandWithStdoutStderr(runCmd)
c.Assert(err, check.IsNil)
out, _ := dockerCmd(c, "network", "ls")
lines := strings.Split(out, "\n")
for i := 1; i < len(lines)-1; i++ {
if strings.Contains(lines[i], name) {
@@ -42,13 +39,9 @@ func (s *DockerSuite) TestDockerNetworkLsDefault(c *check.C) {
}
func (s *DockerSuite) TestDockerNetworkCreateDelete(c *check.C) {
runCmd := exec.Command(dockerBinary, "network", "create", "test")
_, _, _, err := runCommandWithStdoutStderr(runCmd)
c.Assert(err, check.IsNil)
dockerCmd(c, "network", "create", "test")
assertNwIsAvailable(c, "test")
runCmd = exec.Command(dockerBinary, "network", "rm", "test")
_, _, _, err = runCommandWithStdoutStderr(runCmd)
c.Assert(err, check.IsNil)
dockerCmd(c, "network", "rm", "test")
assertNwNotAvailable(c, "test")
}