fixed test to fail when you change the `expectPluginArgs` so that it is different than `args`

Kubernetes-commit: 45fc1f0d93b996b0bc84cdcaec47ff60b8c21b4d
This commit is contained in:
Sam Snarr 2022-10-27 22:18:42 -04:00 committed by Kubernetes Publisher
parent dda6c2b2dd
commit e25bbbc6e1
1 changed files with 3 additions and 1 deletions

View File

@ -23,6 +23,8 @@ import (
"reflect"
"testing"
"github.com/google/go-cmp/cmp"
"github.com/google/go-cmp/cmp/cmpopts"
"github.com/spf13/cobra"
"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)
}
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)
}
})