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

@@ -86,6 +86,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{"rc"}
}
// StatusREST implements the REST endpoint for changing the status of a replication controller
type StatusREST struct {
store *genericregistry.Store

View File

@@ -327,3 +327,11 @@ func TestScaleUpdate(t *testing.T) {
t.Fatalf("unexpected error, expecting an update conflict but got %v", err)
}
}
func TestShortNames(t *testing.T) {
storage, server := newStorage(t)
defer server.Terminate(t)
defer storage.Controller.Store.DestroyFunc()
expected := []string{"rc"}
registrytest.AssertShortNames(t, storage.Controller, expected)
}