mirror of
https://github.com/k3s-io/kubernetes.git
synced 2026-01-06 07:57:35 +00:00
added short names for resources which are exposed during discovery
This commit is contained in:
@@ -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()
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user