Skip to content

Commit

Permalink
construct resource.Builder from kubeconfig flags
Browse files Browse the repository at this point in the history
Kubernetes-commit: 1f5357034b4a8ef4ed68f0c2415e280601968e91
  • Loading branch information
deads2k authored and k8s-publishing-bot committed May 9, 2018
1 parent b224368 commit 3fb1070
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
4 changes: 2 additions & 2 deletions restmapper/category_expansion.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,11 @@ type discoveryCategoryExpander struct {
// NewDiscoveryCategoryExpander returns a category expander that makes use of the "categories" fields from
// the API, found through the discovery client. In case of any error or no category found (which likely
// means we're at a cluster prior to categories support, fallback to the expander provided.
func NewDiscoveryCategoryExpander(client discovery.DiscoveryInterface) (CategoryExpander, error) {
func NewDiscoveryCategoryExpander(client discovery.DiscoveryInterface) CategoryExpander {
if client == nil {
panic("Please provide discovery client to shortcut expander")
}
return discoveryCategoryExpander{discoveryClient: client}, nil
return discoveryCategoryExpander{discoveryClient: client}
}

// Expand fulfills CategoryExpander
Expand Down
5 changes: 1 addition & 4 deletions restmapper/category_expansion_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,10 +135,7 @@ func TestDiscoveryCategoryExpander(t *testing.T) {
dc.serverResourcesHandler = func() ([]*metav1.APIResourceList, error) {
return test.serverResponse, nil
}
expander, err := NewDiscoveryCategoryExpander(dc)
if err != nil {
t.Fatalf("unexpected error %v", err)
}
expander := NewDiscoveryCategoryExpander(dc)
expanded, _ := expander.Expand(test.category)
if !reflect.DeepEqual(expanded, test.expected) {
t.Errorf("expected %v, got %v", test.expected, expanded)
Expand Down

0 comments on commit 3fb1070

Please sign in to comment.