feat: use main func ctx for cobra and use ctx in tests
Explicitly create the context and set it on the CLI, instead of depending on NewDockerCli() to instance a default context. Co-authored-by: Sebastiaan van Stijn <github@gone.nl> Co-authored-by: Alano Terblanche <18033717+Benehiko@users.noreply.github.com> Signed-off-by: Alano Terblanche <18033717+Benehiko@users.noreply.github.com>
This commit is contained in:
committed by
Alano Terblanche
parent
865190615b
commit
86162f7816
@ -11,7 +11,7 @@ import (
|
||||
|
||||
func main() {
|
||||
plugin.Run(func(dockerCli command.Cli) *cobra.Command {
|
||||
cmd := &cobra.Command{
|
||||
return &cobra.Command{
|
||||
Use: "nopersistentprerun",
|
||||
Short: "Testing without PersistentPreRun hooks",
|
||||
// PersistentPreRunE: Not specified, we need to test that it works in the absence of an explicit call
|
||||
@ -25,7 +25,6 @@ func main() {
|
||||
return nil
|
||||
},
|
||||
}
|
||||
return cmd
|
||||
},
|
||||
manager.Metadata{
|
||||
SchemaVersion: "0.1.0",
|
||||
|
||||
Reference in New Issue
Block a user