|
@@ -273,7 +273,7 @@ func assertNwList(c *check.C, out string, expectNws []string) {
|
|
|
|
|
|
func getNwResource(c *check.C, name string) *types.NetworkResource {
|
|
|
out, _ := dockerCmd(c, "network", "inspect", name)
|
|
|
- nr := []types.NetworkResource{}
|
|
|
+ var nr []types.NetworkResource
|
|
|
err := json.Unmarshal([]byte(out), &nr)
|
|
|
c.Assert(err, check.IsNil)
|
|
|
return &nr[0]
|
|
@@ -426,7 +426,7 @@ func (s *DockerSuite) TestDockerNetworkDeleteMultiple(c *check.C) {
|
|
|
|
|
|
func (s *DockerSuite) TestDockerNetworkInspect(c *check.C) {
|
|
|
out, _ := dockerCmd(c, "network", "inspect", "host")
|
|
|
- networkResources := []types.NetworkResource{}
|
|
|
+ var networkResources []types.NetworkResource
|
|
|
err := json.Unmarshal([]byte(out), &networkResources)
|
|
|
c.Assert(err, check.IsNil)
|
|
|
c.Assert(networkResources, checker.HasLen, 1)
|
|
@@ -450,7 +450,7 @@ func (s *DockerSuite) TestDockerInspectMultipleNetwork(c *check.C) {
|
|
|
result := dockerCmdWithResult("network", "inspect", "host", "none")
|
|
|
result.Assert(c, icmd.Success)
|
|
|
|
|
|
- networkResources := []types.NetworkResource{}
|
|
|
+ var networkResources []types.NetworkResource
|
|
|
err := json.Unmarshal([]byte(result.Stdout()), &networkResources)
|
|
|
c.Assert(err, check.IsNil)
|
|
|
c.Assert(networkResources, checker.HasLen, 2)
|
|
@@ -466,7 +466,7 @@ func (s *DockerSuite) TestDockerInspectMultipleNetworksIncludingNonexistent(c *c
|
|
|
Out: "host",
|
|
|
})
|
|
|
|
|
|
- networkResources := []types.NetworkResource{}
|
|
|
+ var networkResources []types.NetworkResource
|
|
|
err := json.Unmarshal([]byte(result.Stdout()), &networkResources)
|
|
|
c.Assert(err, check.IsNil)
|
|
|
c.Assert(networkResources, checker.HasLen, 1)
|
|
@@ -512,7 +512,7 @@ func (s *DockerSuite) TestDockerInspectNetworkWithContainerName(c *check.C) {
|
|
|
}()
|
|
|
|
|
|
out, _ = dockerCmd(c, "network", "inspect", "brNetForInspect")
|
|
|
- networkResources := []types.NetworkResource{}
|
|
|
+ var networkResources []types.NetworkResource
|
|
|
err := json.Unmarshal([]byte(out), &networkResources)
|
|
|
c.Assert(err, check.IsNil)
|
|
|
c.Assert(networkResources, checker.HasLen, 1)
|
|
@@ -526,7 +526,7 @@ func (s *DockerSuite) TestDockerInspectNetworkWithContainerName(c *check.C) {
|
|
|
|
|
|
// check whether network inspect works properly
|
|
|
out, _ = dockerCmd(c, "network", "inspect", "brNetForInspect")
|
|
|
- newNetRes := []types.NetworkResource{}
|
|
|
+ var newNetRes []types.NetworkResource
|
|
|
err = json.Unmarshal([]byte(out), &newNetRes)
|
|
|
c.Assert(err, check.IsNil)
|
|
|
c.Assert(newNetRes, checker.HasLen, 1)
|