provide standard iostream struct for commands
This commit is contained in:
@@ -30,6 +30,7 @@ import (
|
||||
"k8s.io/kubernetes/pkg/kubectl"
|
||||
cmdtesting "k8s.io/kubernetes/pkg/kubectl/cmd/testing"
|
||||
cmdutil "k8s.io/kubernetes/pkg/kubectl/cmd/util"
|
||||
"k8s.io/kubernetes/pkg/kubectl/genericclioptions"
|
||||
)
|
||||
|
||||
func Test_generatorFromName(t *testing.T) {
|
||||
@@ -104,9 +105,9 @@ func TestCreateDeployment(t *testing.T) {
|
||||
}
|
||||
tf.ClientConfigVal = &restclient.Config{}
|
||||
tf.Namespace = "test"
|
||||
buf := bytes.NewBuffer([]byte{})
|
||||
|
||||
cmd := NewCmdCreateDeployment(tf, buf, buf)
|
||||
ioStreams, _, buf, _ := genericclioptions.NewTestIOStreams()
|
||||
cmd := NewCmdCreateDeployment(tf, ioStreams)
|
||||
cmd.Flags().Set("dry-run", "true")
|
||||
cmd.Flags().Set("output", "name")
|
||||
cmd.Flags().Set("image", "hollywood/jonny.depp:v2")
|
||||
@@ -136,16 +137,14 @@ func TestCreateDeploymentNoImage(t *testing.T) {
|
||||
tf.ClientConfigVal = &restclient.Config{}
|
||||
tf.Namespace = "test"
|
||||
|
||||
buf := bytes.NewBuffer([]byte{})
|
||||
errBuff := bytes.NewBuffer([]byte{})
|
||||
cmd := NewCmdCreateDeployment(tf, buf, errBuff)
|
||||
ioStreams := genericclioptions.NewTestIOStreamsDiscard()
|
||||
cmd := NewCmdCreateDeployment(tf, ioStreams)
|
||||
cmd.Flags().Set("output", "name")
|
||||
options := &DeploymentOpts{
|
||||
CreateSubcommandOptions: &CreateSubcommandOptions{
|
||||
PrintFlags: NewPrintFlags("created"),
|
||||
CmdOut: buf,
|
||||
CmdErr: errBuff,
|
||||
DryRun: true,
|
||||
IOStreams: ioStreams,
|
||||
},
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user