diff --git a/tools/clientcmd/validation_test.go b/tools/clientcmd/validation_test.go index 7b8e2fd5..3c56498a 100644 --- a/tools/clientcmd/validation_test.go +++ b/tools/clientcmd/validation_test.go @@ -748,37 +748,31 @@ func TestErrConfigurationInvalidWithErrorsIs(t *testing.T) { err error matchAgainst error expectMatch bool - }{ - { - name: "no match", - err: errConfigurationInvalid{errors.New("my-error"), errors.New("my-other-error")}, - matchAgainst: fmt.Errorf("no entry %s", "here"), - }, - { - name: "match via .Is()", - err: errConfigurationInvalid{errors.New("forbidden"), alwaysMatchingError{}}, - matchAgainst: errors.New("unauthorized"), - expectMatch: true, - }, - { - name: "match via equality", - err: errConfigurationInvalid{errors.New("err"), someError{}}, - matchAgainst: someError{}, - expectMatch: true, - }, - { - name: "match via nested aggregate", - err: errConfigurationInvalid{errors.New("closed today"), errConfigurationInvalid{errConfigurationInvalid{someError{}}}}, - matchAgainst: someError{}, - expectMatch: true, - }, - { - name: "match via wrapped aggregate", - err: fmt.Errorf("wrap: %w", errConfigurationInvalid{errors.New("err"), someError{}}), - matchAgainst: someError{}, - expectMatch: true, - }, - } + }{{ + name: "no match", + err: errConfigurationInvalid{errors.New("my-error"), errors.New("my-other-error")}, + matchAgainst: fmt.Errorf("no entry %s", "here"), + }, { + name: "match via .Is()", + err: errConfigurationInvalid{errors.New("forbidden"), alwaysMatchingError{}}, + matchAgainst: errors.New("unauthorized"), + expectMatch: true, + }, { + name: "match via equality", + err: errConfigurationInvalid{errors.New("err"), someError{}}, + matchAgainst: someError{}, + expectMatch: true, + }, { + name: "match via nested aggregate", + err: errConfigurationInvalid{errors.New("closed today"), errConfigurationInvalid{errConfigurationInvalid{someError{}}}}, + matchAgainst: someError{}, + expectMatch: true, + }, { + name: "match via wrapped aggregate", + err: fmt.Errorf("wrap: %w", errConfigurationInvalid{errors.New("err"), someError{}}), + matchAgainst: someError{}, + expectMatch: true, + }} for _, tc := range testCases { t.Run(tc.name, func(t *testing.T) {