Add verb support for discovery client

This commit is contained in:
Dr. Stefan Schimanski
2016-11-17 14:19:03 +01:00
committed by Dr. Stefan Schimanski
parent 4d1d98c49a
commit 458d2b2fe4
18 changed files with 580 additions and 208 deletions

View File

@@ -45,7 +45,7 @@ type Fake struct {
// for every request in the order they are tried.
ProxyReactionChain []ProxyReactor
Resources map[string]*metav1.APIResourceList
Resources []*metav1.APIResourceList
}
// Reactor is an interface to allow the composition of reaction functions.
@@ -225,10 +225,16 @@ func (c *FakeDiscovery) ServerResourcesForGroupVersion(groupVersion string) (*me
Resource: schema.GroupVersionResource{Resource: "resource"},
}
c.Invokes(action, nil)
return c.Resources[groupVersion], nil
for _, rl := range c.Resources {
if rl.GroupVersion == groupVersion {
return rl, nil
}
}
return nil, fmt.Errorf("GroupVersion %q not found", groupVersion)
}
func (c *FakeDiscovery) ServerResources() (map[string]*metav1.APIResourceList, error) {
func (c *FakeDiscovery) ServerResources() ([]*metav1.APIResourceList, error) {
action := ActionImpl{
Verb: "get",
Resource: schema.GroupVersionResource{Resource: "resource"},