construct resource.Builder from kubeconfig flags

Kubernetes-commit: 1f5357034b4a8ef4ed68f0c2415e280601968e91
This commit is contained in:
David Eads 2018-05-09 13:53:07 -04:00 committed by Kubernetes Publisher
parent b2243688f8
commit 3fb1070233
2 changed files with 3 additions and 6 deletions

View File

@ -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

View File

@ -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)