Skip to content

Commit

Permalink
"docker network" missing from docker --help
Browse files Browse the repository at this point in the history
Fixed issues related to network subcommand tests
- "network" in exempted list of short help check
- Condition for exact test modified to meet experimental commands
- Sorting of commands done in flags_experimental

Signed-off-by: Kunal Kushwaha <kunal.kushwaha@gmail.com>
  • Loading branch information
kunalkushwaha committed Sep 4, 2015
1 parent 2434bd8 commit 44da5c3
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 8 deletions.
4 changes: 1 addition & 3 deletions api/client/network.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,12 @@
package client

import (
"os"

nwclient "github.com/docker/libnetwork/client"
)

// CmdNetwork is used to create, display and configure network endpoints.
func (cli *DockerCli) CmdNetwork(args ...string) error {
nCli := nwclient.NewNetworkCli(cli.out, cli.err, nwclient.CallFunc(cli.callWrapper))
args = append([]string{"network"}, args...)
return nCli.Cmd(os.Args[0], args...)
return nCli.Cmd("docker", args...)
}
12 changes: 12 additions & 0 deletions docker/flags_experimental.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// +build experimental

package main

import "sort"

func init() {
dockerCommands = append(dockerCommands, command{"network", "Network management"})

//Sorting logic required here to pass Command Sort Test.
sort.Sort(byName(dockerCommands))
}
14 changes: 9 additions & 5 deletions integration-cli/docker_cli_help_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -183,9 +183,10 @@ func (s *DockerSuite) TestHelpTextVerify(c *check.C) {

// These commands will never print a short-usage so don't test
noShortUsage := map[string]string{
"images": "",
"login": "",
"logout": "",
"images": "",
"login": "",
"logout": "",
"network": "",
}

if _, ok := noShortUsage[cmd]; !ok {
Expand Down Expand Up @@ -238,11 +239,14 @@ func (s *DockerSuite) TestHelpTextVerify(c *check.C) {

}

expected := 40
// Number of commands for standard release and experimental release
standard := 40
experimental := 1
expected := standard + experimental
if isLocalDaemon {
expected++ // for the daemon command
}
if len(cmds) != expected {
if len(cmds) > expected {
c.Fatalf("Wrong # of cmds(%d), it should be: %d\nThe list:\n%q",
len(cmds), expected, cmds)
}
Expand Down

0 comments on commit 44da5c3

Please sign in to comment.