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

@@ -87,6 +87,14 @@ func NewREST(optsGetter generic.RESTOptionsGetter) (*REST, *StatusREST, *Rollbac
return &REST{store}, &StatusREST{store: &statusStore}, &RollbackREST{store: store}
}
// 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{"deploy"}
}
// StatusREST implements the REST endpoint for changing the status of a deployment
type StatusREST struct {
store *genericregistry.Store

View File

@@ -388,3 +388,11 @@ func TestEtcdCreateDeploymentRollbackNoDeployment(t *testing.T) {
t.Fatalf("Unexpected error: %v", err)
}
}
func TestShortNames(t *testing.T) {
storage, server := newStorage(t)
defer server.Terminate(t)
defer storage.Deployment.Store.DestroyFunc()
expected := []string{"deploy"}
registrytest.AssertShortNames(t, storage.Deployment, expected)
}