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

@@ -173,6 +173,14 @@ func (r *REST) Delete(ctx genericapirequest.Context, name string, options *metav
return r.Store.Delete(ctx, name, options)
}
// 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{"ns"}
}
func (r *StatusREST) New() runtime.Object {
return r.store.New()
}

View File

@@ -186,3 +186,11 @@ func TestDeleteNamespaceWithCompleteFinalizers(t *testing.T) {
t.Errorf("unexpected error: %v", err)
}
}
func TestShortNames(t *testing.T) {
storage, server := newStorage(t)
defer server.Terminate(t)
defer storage.Store.DestroyFunc()
expected := []string{"ns"}
registrytest.AssertShortNames(t, storage, expected)
}