1
0
mirror of https://github.com/moby/moby.git synced 2025-10-24 09:13:09 +03:00

Fixes after dnephin review

Signed-off-by: Christopher Crone <christopher.crone@docker.com>
This commit is contained in:
Christopher Crone
2017-09-14 19:17:49 +02:00
parent 81f69a5931
commit 7dabed019a
17 changed files with 87 additions and 118 deletions

View File

@@ -10,7 +10,6 @@ import (
"net/http"
"net/http/httptest"
"os"
"path/filepath"
"strings"
"time"
@@ -288,41 +287,6 @@ func (s *DockerNetworkSuite) TestDockerNetworkLsDefault(c *check.C) {
}
}
func (s *DockerSuite) TestNetworkLsFormat(c *check.C) {
// E2E: Test assumes only default networks.
testRequires(c, DaemonIsLinux, NotE2E)
out, _ := dockerCmd(c, "network", "ls", "--format", "{{.Name}}")
lines := strings.Split(strings.TrimSpace(string(out)), "\n")
expected := []string{"bridge", "host", "none"}
var names []string
names = append(names, lines...)
c.Assert(expected, checker.DeepEquals, names, check.Commentf("Expected array with truncated names: %v, got: %v", expected, names))
}
func (s *DockerSuite) TestNetworkLsFormatDefaultFormat(c *check.C) {
// E2E: Test assumes only default networks.
testRequires(c, DaemonIsLinux, NotE2E)
config := `{
"networksFormat": "{{ .Name }} default"
}`
d, err := ioutil.TempDir("", "integration-cli-")
c.Assert(err, checker.IsNil)
defer os.RemoveAll(d)
err = ioutil.WriteFile(filepath.Join(d, "config.json"), []byte(config), 0644)
c.Assert(err, checker.IsNil)
out, _ := dockerCmd(c, "--config", d, "network", "ls")
lines := strings.Split(strings.TrimSpace(string(out)), "\n")
expected := []string{"bridge default", "host default", "none default"}
var names []string
names = append(names, lines...)
c.Assert(expected, checker.DeepEquals, names, check.Commentf("Expected array with truncated names: %v, got: %v", expected, names))
}
func (s *DockerNetworkSuite) TestDockerNetworkCreatePredefined(c *check.C) {
predefined := []string{"bridge", "host", "none", "default"}
for _, net := range predefined {
@@ -353,8 +317,7 @@ func (s *DockerNetworkSuite) TestDockerNetworkRmPredefined(c *check.C) {
}
func (s *DockerNetworkSuite) TestDockerNetworkLsFilter(c *check.C) {
// E2E: Test assumes clean network environment.
testRequires(c, NotE2E)
testRequires(c, OnlyDefaultNetworks)
testNet := "testnet1"
testLabel := "foo"
testValue := "bar"