diff --git a/hack/make-rules/test-cmd-util.sh b/hack/make-rules/test-cmd-util.sh index c0f279b83d390..eca925cd2c9fa 100755 --- a/hack/make-rules/test-cmd-util.sh +++ b/hack/make-rules/test-cmd-util.sh @@ -4689,7 +4689,7 @@ runTests() { kube::test::if_has_string "${output_message}" "yes" output_message=$(! kubectl auth can-i get /logs/ --subresource=log 2>&1 "${kube_flags[@]}") - kube::test::if_has_string "${output_message}" "subresource can not be used with nonResourceURL" + kube::test::if_has_string "${output_message}" "subresource can not be used with NonResourceURL" output_message=$(kubectl auth can-i list jobs.batch/bar -n foo --quiet 2>&1 "${kube_flags[@]}") kube::test::if_empty_string "${output_message}" diff --git a/pkg/kubectl/cmd/auth/cani.go b/pkg/kubectl/cmd/auth/cani.go index 5e4b84c80cce0..97e461a46fc6c 100644 --- a/pkg/kubectl/cmd/auth/cani.go +++ b/pkg/kubectl/cmd/auth/cani.go @@ -156,10 +156,10 @@ func (o *CanIOptions) Complete(f cmdutil.Factory, args []string) error { func (o *CanIOptions) Validate() error { if o.NonResourceURL != "" { if o.Subresource != "" { - return fmt.Errorf("--subresource can not be used with nonResourceURL") + return fmt.Errorf("--subresource can not be used with NonResourceURL") } if o.Resource != (schema.GroupVersionResource{}) || o.ResourceName != "" { - return fmt.Errorf("nonResourceURL and Resource can not specified together") + return fmt.Errorf("NonResourceURL and ResourceName can not specified together") } } return nil diff --git a/pkg/kubectl/cmd/auth/cani_test.go b/pkg/kubectl/cmd/auth/cani_test.go index 522361d30d507..a2210ec87cdd1 100644 --- a/pkg/kubectl/cmd/auth/cani_test.go +++ b/pkg/kubectl/cmd/auth/cani_test.go @@ -124,8 +124,9 @@ func TestRunAccessCheck(t *testing.T) { APIRegistry: api.Registry, NegotiatedSerializer: ns, Client: fake.CreateHTTPClient(func(req *http.Request) (*http.Response, error) { - if req.URL.Path != "/apis/authorization.k8s.io/v1/selfsubjectaccessreviews" { - t.Errorf("%s: %v", test.name, req.URL.Path) + expectPath := "/apis/authorization.k8s.io/v1/selfsubjectaccessreviews" + if req.URL.Path != expectPath { + t.Errorf("%s: expected %v, got %v", test.name, expectPath, req.URL.Path) return nil, nil } bodyBits, err := ioutil.ReadAll(req.Body) diff --git a/pkg/kubectl/cmd/auth/reconcile.go b/pkg/kubectl/cmd/auth/reconcile.go index 2dc8ca44e80c2..948d8f3fac51f 100644 --- a/pkg/kubectl/cmd/auth/reconcile.go +++ b/pkg/kubectl/cmd/auth/reconcile.go @@ -157,7 +157,6 @@ func (o *ReconcileOptions) RunReconcile() error { } shallowInfoCopy.Object = result.Role.GetObject() o.Print(&shallowInfoCopy) - return nil case *rbac.ClusterRole: reconcileOptions := reconciliation.ReconcileRoleOptions{ @@ -174,7 +173,6 @@ func (o *ReconcileOptions) RunReconcile() error { } shallowInfoCopy.Object = result.Role.GetObject() o.Print(&shallowInfoCopy) - return nil case *rbac.RoleBinding: reconcileOptions := reconciliation.ReconcileRoleBindingOptions{ @@ -192,7 +190,6 @@ func (o *ReconcileOptions) RunReconcile() error { } shallowInfoCopy.Object = result.RoleBinding.GetObject() o.Print(&shallowInfoCopy) - return nil case *rbac.ClusterRoleBinding: reconcileOptions := reconciliation.ReconcileRoleBindingOptions{ @@ -209,7 +206,6 @@ func (o *ReconcileOptions) RunReconcile() error { } shallowInfoCopy.Object = result.RoleBinding.GetObject() o.Print(&shallowInfoCopy) - return nil default: glog.V(1).Infof("skipping %#v", info.Object.GetObjectKind())