mirror of https://github.com/docker/cli.git
cmd: docker: fix TestDaemonCommand
In more recent versions of Cobra, `--help` parsing is done before anything else resulting in TestDaemonCommand not actually passing. I'm actually unsure if this test ever passed since it appears that !daemon is not being run as part of the test suite. Signed-off-by: Aleksa Sarai <asarai@suse.de>
This commit is contained in:
parent
d5010088e3
commit
aa74f27866
|
@ -12,8 +12,10 @@ import (
|
||||||
|
|
||||||
func newDaemonCommand() *cobra.Command {
|
func newDaemonCommand() *cobra.Command {
|
||||||
return &cobra.Command{
|
return &cobra.Command{
|
||||||
Use: "daemon",
|
Use: "daemon",
|
||||||
Hidden: true,
|
Hidden: true,
|
||||||
|
Args: cobra.ArbitraryArgs,
|
||||||
|
DisableFlagParsing: true,
|
||||||
RunE: func(cmd *cobra.Command, args []string) error {
|
RunE: func(cmd *cobra.Command, args []string) error {
|
||||||
return runDaemon()
|
return runDaemon()
|
||||||
},
|
},
|
||||||
|
|
|
@ -10,7 +10,7 @@ import (
|
||||||
|
|
||||||
func TestDaemonCommand(t *testing.T) {
|
func TestDaemonCommand(t *testing.T) {
|
||||||
cmd := newDaemonCommand()
|
cmd := newDaemonCommand()
|
||||||
cmd.SetArgs([]string{"--help"})
|
cmd.SetArgs([]string{"--version"})
|
||||||
err := cmd.Execute()
|
err := cmd.Execute()
|
||||||
|
|
||||||
assert.Error(t, err, "Please run `dockerd`")
|
assert.Error(t, err, "Please run `dockerd`")
|
||||||
|
|
Loading…
Reference in New Issue