Merge pull request #104227 from astraw99/fix_typo

Fix typo `registry`
This commit is contained in:
Kubernetes Prow Robot 2021-10-01 16:49:05 -07:00 committed by GitHub
commit 0465cd7d04
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 8 deletions

View File

@ -58,7 +58,7 @@ func (s *APIEnablementOptions) AddFlags(fs *pflag.FlagSet) {
// But in the advanced (and usually not recommended) case of delegated apiservers there can be more. // But in the advanced (and usually not recommended) case of delegated apiservers there can be more.
// Validate will filter out the known groups of each registry. // Validate will filter out the known groups of each registry.
// If anything is left over after that, an error is returned. // If anything is left over after that, an error is returned.
func (s *APIEnablementOptions) Validate(registries ...GroupRegisty) []error { func (s *APIEnablementOptions) Validate(registries ...GroupRegistry) []error {
if s == nil { if s == nil {
return nil return nil
} }
@ -98,7 +98,7 @@ func (s *APIEnablementOptions) ApplyTo(c *server.Config, defaultResourceConfig *
return err return err
} }
func unknownGroups(groups []string, registry GroupRegisty) []string { func unknownGroups(groups []string, registry GroupRegistry) []string {
unknownGroups := []string{} unknownGroups := []string{}
for _, group := range groups { for _, group := range groups {
if !registry.IsGroupRegistered(group) { if !registry.IsGroupRegistered(group) {
@ -108,8 +108,8 @@ func unknownGroups(groups []string, registry GroupRegisty) []string {
return unknownGroups return unknownGroups
} }
// GroupRegisty provides a method to check whether given group is registered. // GroupRegistry provides a method to check whether given group is registered.
type GroupRegisty interface { type GroupRegistry interface {
// IsRegistered returns true if given group is registered. // IsRegistered returns true if given group is registered.
IsGroupRegistered(group string) bool IsGroupRegistered(group string) bool
} }

View File

@ -24,9 +24,9 @@ import (
cliflag "k8s.io/component-base/cli/flag" cliflag "k8s.io/component-base/cli/flag"
) )
type fakeGroupRegisty struct{} type fakeGroupRegistry struct{}
func (f fakeGroupRegisty) IsGroupRegistered(group string) bool { func (f fakeGroupRegistry) IsGroupRegistered(group string) bool {
return group == "apiregistration.k8s.io" return group == "apiregistration.k8s.io"
} }
@ -67,11 +67,11 @@ func TestAPIEnablementOptionsValidate(t *testing.T) {
}, },
}, },
} }
testGroupRegisty := fakeGroupRegisty{} testGroupRegistry := fakeGroupRegistry{}
for _, testcase := range testCases { for _, testcase := range testCases {
t.Run(testcase.name, func(t *testing.T) { t.Run(testcase.name, func(t *testing.T) {
errs := testcase.testOptions.Validate(testGroupRegisty) errs := testcase.testOptions.Validate(testGroupRegistry)
if len(testcase.expectErr) != 0 && !strings.Contains(utilerrors.NewAggregate(errs).Error(), testcase.expectErr) { if len(testcase.expectErr) != 0 && !strings.Contains(utilerrors.NewAggregate(errs).Error(), testcase.expectErr) {
t.Errorf("got err: %v, expected err: %s", errs, testcase.expectErr) t.Errorf("got err: %v, expected err: %s", errs, testcase.expectErr)
} }