added short names for resources which are exposed during discovery

This commit is contained in:
p0lyn0mial
2017-02-05 17:44:53 +01:00
parent d4bcf3ede5
commit b2cce0ac8e
50 changed files with 372 additions and 1 deletions

View File

@@ -61,6 +61,14 @@ func NewREST(optsGetter generic.RESTOptionsGetter) (*REST, *StatusREST) {
return &REST{store}, &StatusREST{store: &statusStore}
}
// Implement ShortNamesProvider
var _ rest.ShortNamesProvider = &REST{}
// ShortNames implements the ShortNamesProvider interface. Returns a list of short names for a resource.
func (r *REST) ShortNames() []string {
return []string{"pv"}
}
// StatusREST implements the REST endpoint for changing the status of a persistentvolume.
type StatusREST struct {
store *genericregistry.Store

View File

@@ -195,3 +195,11 @@ func TestUpdateStatus(t *testing.T) {
t.Errorf("unexpected object: %s", diff.ObjectDiff(pvIn.Status, pvOut.Status))
}
}
func TestShortNames(t *testing.T) {
storage, _, server := newStorage(t)
defer server.Terminate(t)
defer storage.Store.DestroyFunc()
expected := []string{"pv"}
registrytest.AssertShortNames(t, storage, expected)
}