enforce include-uninitialized in several kubectl commands

This commit is contained in:
Di Xu
2017-08-11 14:21:44 +08:00
parent 789a95971d
commit be0cadde2e
19 changed files with 123 additions and 38 deletions

View File

@@ -26,6 +26,8 @@ import (
"testing"
"time"
"github.com/spf13/cobra"
"k8s.io/apimachinery/pkg/api/errors"
"k8s.io/apimachinery/pkg/api/meta"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
@@ -41,6 +43,13 @@ import (
var unstructuredSerializer = dynamic.ContentConfig().NegotiatedSerializer
var fakecmd = &cobra.Command{
Use: "delete ([-f FILENAME] | TYPE [(NAME | -l label | --all)])",
Run: func(cmd *cobra.Command, args []string) {
cmdutil.CheckErr(cmdutil.ValidateOutputArgs(cmd))
},
}
func TestDeleteObjectByTuple(t *testing.T) {
initTestErrorHandler(t)
_, _, rc := testData()
@@ -345,7 +354,7 @@ func TestDeleteObjectNotFound(t *testing.T) {
Cascade: false,
Output: "name",
}
err := options.Complete(f, buf, errBuf, []string{})
err := options.Complete(f, buf, errBuf, []string{}, fakecmd)
if err != nil {
t.Errorf("unexpected error: %v", err)
}
@@ -426,7 +435,7 @@ func TestDeleteAllNotFound(t *testing.T) {
IgnoreNotFound: false,
Output: "name",
}
err := options.Complete(f, buf, errBuf, []string{"services"})
err := options.Complete(f, buf, errBuf, []string{"services"}, fakecmd)
if err != nil {
t.Errorf("unexpected error: %v", err)
}
@@ -546,7 +555,7 @@ func TestDeleteMultipleObjectContinueOnMissing(t *testing.T) {
Cascade: false,
Output: "name",
}
err := options.Complete(f, buf, errBuf, []string{})
err := options.Complete(f, buf, errBuf, []string{}, fakecmd)
if err != nil {
t.Errorf("unexpected error: %v", err)
}
@@ -714,7 +723,7 @@ func TestResourceErrors(t *testing.T) {
Cascade: false,
Output: "name",
}
err := options.Complete(f, buf, errBuf, testCase.args)
err := options.Complete(f, buf, errBuf, testCase.args, fakecmd)
if !testCase.errFn(err) {
t.Errorf("%s: unexpected error: %v", k, err)
continue