wire printflags through additional cmds

This commit is contained in:
juanvallejo
2018-04-18 20:02:37 -04:00
parent 29630b5124
commit 27bd4ded04
42 changed files with 746 additions and 388 deletions

View File

@@ -36,6 +36,7 @@ import (
"k8s.io/client-go/rest/fake"
"k8s.io/kubernetes/pkg/api/legacyscheme"
cmdtesting "k8s.io/kubernetes/pkg/kubectl/cmd/testing"
"k8s.io/kubernetes/pkg/kubectl/genericclioptions"
"k8s.io/kubernetes/pkg/kubectl/scheme"
)
@@ -526,7 +527,8 @@ func TestCopyToPod(t *testing.T) {
tf.ClientConfigVal = defaultClientConfig()
buf := bytes.NewBuffer([]byte{})
errBuf := bytes.NewBuffer([]byte{})
cmd := NewCmdCp(tf, buf, errBuf)
cmd := NewCmdCp(tf, genericclioptions.IOStreams{Out: buf, ErrOut: errBuf})
srcFile, err := ioutil.TempDir("", "test")
if err != nil {
@@ -554,6 +556,7 @@ func TestCopyToPod(t *testing.T) {
}
for name, test := range tests {
opts := NewCopyOptions(genericclioptions.IOStreams{Out: buf, ErrOut: errBuf})
src := fileSpec{
File: srcFile,
}
@@ -562,8 +565,9 @@ func TestCopyToPod(t *testing.T) {
PodName: "pod-name",
File: test.dest,
}
opts.Complete(tf, cmd)
t.Run(name, func(t *testing.T) {
err = copyToPod(tf, cmd, buf, errBuf, src, dest)
err = opts.copyToPod(src, dest)
//If error is NotFound error , it indicates that the
//request has been sent correctly.
//Treat this as no error.