Merge pull request #113423 from sss-ng/bugfix/fix-cmd-test

fixed kubectl test that passes when it should fail on changed test input

Kubernetes-commit: 367f01f62d1a6ca149c317f97a958dd5c6e74af1
This commit is contained in:
Kubernetes Publisher 2022-10-28 07:32:43 -07:00
commit 6a94e99926
3 changed files with 7 additions and 5 deletions

4
go.mod
View File

@ -32,7 +32,7 @@ require (
k8s.io/api v0.0.0-20221028075226-689257039cfb k8s.io/api v0.0.0-20221028075226-689257039cfb
k8s.io/apimachinery v0.0.0-20221028155017-b03a432a2a6d k8s.io/apimachinery v0.0.0-20221028155017-b03a432a2a6d
k8s.io/cli-runtime v0.0.0-20221028082309-76d40a058aae k8s.io/cli-runtime v0.0.0-20221028082309-76d40a058aae
k8s.io/client-go v0.0.0-20221028155553-a232cf00b972 k8s.io/client-go v0.0.0-20221028155554-0d5739633518
k8s.io/component-base v0.0.0-20221028160413-57523092d0c2 k8s.io/component-base v0.0.0-20221028160413-57523092d0c2
k8s.io/component-helpers v0.0.0-20221028160522-56bb98a3ab81 k8s.io/component-helpers v0.0.0-20221028160522-56bb98a3ab81
k8s.io/klog/v2 v2.80.1 k8s.io/klog/v2 v2.80.1
@ -94,7 +94,7 @@ replace (
k8s.io/api => k8s.io/api v0.0.0-20221028075226-689257039cfb k8s.io/api => k8s.io/api v0.0.0-20221028075226-689257039cfb
k8s.io/apimachinery => k8s.io/apimachinery v0.0.0-20221028155017-b03a432a2a6d k8s.io/apimachinery => k8s.io/apimachinery v0.0.0-20221028155017-b03a432a2a6d
k8s.io/cli-runtime => k8s.io/cli-runtime v0.0.0-20221028082309-76d40a058aae k8s.io/cli-runtime => k8s.io/cli-runtime v0.0.0-20221028082309-76d40a058aae
k8s.io/client-go => k8s.io/client-go v0.0.0-20221028155553-a232cf00b972 k8s.io/client-go => k8s.io/client-go v0.0.0-20221028155554-0d5739633518
k8s.io/code-generator => k8s.io/code-generator v0.0.0-20221028154808-081720d0e256 k8s.io/code-generator => k8s.io/code-generator v0.0.0-20221028154808-081720d0e256
k8s.io/component-base => k8s.io/component-base v0.0.0-20221028160413-57523092d0c2 k8s.io/component-base => k8s.io/component-base v0.0.0-20221028160413-57523092d0c2
k8s.io/component-helpers => k8s.io/component-helpers v0.0.0-20221028160522-56bb98a3ab81 k8s.io/component-helpers => k8s.io/component-helpers v0.0.0-20221028160522-56bb98a3ab81

4
go.sum
View File

@ -546,8 +546,8 @@ k8s.io/apimachinery v0.0.0-20221028155017-b03a432a2a6d h1:fg/DbLqFKxFESf3AnU5iwC
k8s.io/apimachinery v0.0.0-20221028155017-b03a432a2a6d/go.mod h1:zSkBXgO5G/dSQOe256tx5Yo2OJytojpY3bsXu/4/ZJE= k8s.io/apimachinery v0.0.0-20221028155017-b03a432a2a6d/go.mod h1:zSkBXgO5G/dSQOe256tx5Yo2OJytojpY3bsXu/4/ZJE=
k8s.io/cli-runtime v0.0.0-20221028082309-76d40a058aae h1:phqrhTIhN89dieCciPqSOFn2AUFK/WhRMNxsP9rg9AE= k8s.io/cli-runtime v0.0.0-20221028082309-76d40a058aae h1:phqrhTIhN89dieCciPqSOFn2AUFK/WhRMNxsP9rg9AE=
k8s.io/cli-runtime v0.0.0-20221028082309-76d40a058aae/go.mod h1:8Za6U2FoTs3UoLXV5Q8VJIpf4bJypigmS2rfXgvwaH4= k8s.io/cli-runtime v0.0.0-20221028082309-76d40a058aae/go.mod h1:8Za6U2FoTs3UoLXV5Q8VJIpf4bJypigmS2rfXgvwaH4=
k8s.io/client-go v0.0.0-20221028155553-a232cf00b972 h1:Xhhs4dBca/3rT0is6GDMtFjKyviLZkdlw1xRwvYFsww= k8s.io/client-go v0.0.0-20221028155554-0d5739633518 h1:KlSjZkXeVyocbVpEU157nadMdQIfWXchaItVtjmMVUE=
k8s.io/client-go v0.0.0-20221028155553-a232cf00b972/go.mod h1:9OZTm80DH1AI7P4cpx8yehVlTU1xZQCsMtAtlJYLWDw= k8s.io/client-go v0.0.0-20221028155554-0d5739633518/go.mod h1:9OZTm80DH1AI7P4cpx8yehVlTU1xZQCsMtAtlJYLWDw=
k8s.io/component-base v0.0.0-20221028160413-57523092d0c2 h1:lHXBae/IFHPh8Lu9rDRTzt6KyTiBkKvRJWeLTYpXFDA= k8s.io/component-base v0.0.0-20221028160413-57523092d0c2 h1:lHXBae/IFHPh8Lu9rDRTzt6KyTiBkKvRJWeLTYpXFDA=
k8s.io/component-base v0.0.0-20221028160413-57523092d0c2/go.mod h1:ng9M2gjWKyA3UKzYYImYBFvpk731uuzazqB7Ti2cKmA= k8s.io/component-base v0.0.0-20221028160413-57523092d0c2/go.mod h1:ng9M2gjWKyA3UKzYYImYBFvpk731uuzazqB7Ti2cKmA=
k8s.io/component-helpers v0.0.0-20221028160522-56bb98a3ab81 h1:3CC/oNrmdSptGTCO0NGfo4HsUGjQOfFL8xAret+O6Vc= k8s.io/component-helpers v0.0.0-20221028160522-56bb98a3ab81 h1:3CC/oNrmdSptGTCO0NGfo4HsUGjQOfFL8xAret+O6Vc=

View File

@ -23,6 +23,8 @@ import (
"reflect" "reflect"
"testing" "testing"
"github.com/google/go-cmp/cmp"
"github.com/google/go-cmp/cmp/cmpopts"
"github.com/spf13/cobra" "github.com/spf13/cobra"
"k8s.io/cli-runtime/pkg/genericclioptions" "k8s.io/cli-runtime/pkg/genericclioptions"
) )
@ -143,7 +145,7 @@ func TestKubectlCommandHandlesPlugins(t *testing.T) {
t.Fatalf("unexpected plugin execution: expected %q, got %q", test.expectPlugin, pluginsHandler.executedPlugin) t.Fatalf("unexpected plugin execution: expected %q, got %q", test.expectPlugin, pluginsHandler.executedPlugin)
} }
if len(pluginsHandler.withArgs) != len(test.expectPluginArgs) { if !cmp.Equal(pluginsHandler.withArgs, test.expectPluginArgs, cmpopts.EquateEmpty()) {
t.Fatalf("unexpected plugin execution args: expected %q, got %q", test.expectPluginArgs, pluginsHandler.withArgs) t.Fatalf("unexpected plugin execution args: expected %q, got %q", test.expectPluginArgs, pluginsHandler.withArgs)
} }
}) })