Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix typo registry #104227

Merged
merged 1 commit into from
Oct 1, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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.
// Validate will filter out the known groups of each registry.
// 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 {
return nil
}
Expand Down Expand Up @@ -98,7 +98,7 @@ func (s *APIEnablementOptions) ApplyTo(c *server.Config, defaultResourceConfig *
return err
}

func unknownGroups(groups []string, registry GroupRegisty) []string {
func unknownGroups(groups []string, registry GroupRegistry) []string {
unknownGroups := []string{}
for _, group := range groups {
if !registry.IsGroupRegistered(group) {
Expand All @@ -108,8 +108,8 @@ func unknownGroups(groups []string, registry GroupRegisty) []string {
return unknownGroups
}

// GroupRegisty provides a method to check whether given group is registered.
type GroupRegisty interface {
// GroupRegistry provides a method to check whether given group is registered.
type GroupRegistry interface {
// IsRegistered returns true if given group is registered.
IsGroupRegistered(group string) bool
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ import (
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"
}

Expand Down Expand Up @@ -67,11 +67,11 @@ func TestAPIEnablementOptionsValidate(t *testing.T) {
},
},
}
testGroupRegisty := fakeGroupRegisty{}
testGroupRegistry := fakeGroupRegistry{}

for _, testcase := range testCases {
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) {
t.Errorf("got err: %v, expected err: %s", errs, testcase.expectErr)
}
Expand Down