diff --git a/pkg/registry/binding/rest.go b/pkg/registry/binding/rest.go index 4a2350f0f9d..52907852c93 100644 --- a/pkg/registry/binding/rest.go +++ b/pkg/registry/binding/rest.go @@ -20,9 +20,7 @@ import ( "fmt" "github.com/GoogleCloudPlatform/kubernetes/pkg/api" - "github.com/GoogleCloudPlatform/kubernetes/pkg/api/errors" "github.com/GoogleCloudPlatform/kubernetes/pkg/apiserver" - "github.com/GoogleCloudPlatform/kubernetes/pkg/labels" "github.com/GoogleCloudPlatform/kubernetes/pkg/runtime" ) @@ -40,21 +38,6 @@ func NewREST(bindingRegistry Registry) *REST { } } -// List returns an error because bindings are write-only objects. -func (*REST) List(ctx api.Context, label, field labels.Selector) (runtime.Object, error) { - return nil, errors.NewNotFound("binding", "list") -} - -// Get returns an error because bindings are write-only objects. -func (*REST) Get(ctx api.Context, id string) (runtime.Object, error) { - return nil, errors.NewNotFound("binding", id) -} - -// Delete returns an error because bindings are write-only objects. -func (*REST) Delete(ctx api.Context, id string) (<-chan apiserver.RESTResult, error) { - return nil, errors.NewNotFound("binding", id) -} - // New returns a new binding object fit for having data unmarshalled into it. func (*REST) New() runtime.Object { return &api.Binding{} @@ -73,8 +56,3 @@ func (b *REST) Create(ctx api.Context, obj runtime.Object) (<-chan apiserver.RES return &api.Status{Status: api.StatusSuccess}, nil }), nil } - -// Update returns an error-- this object may not be updated. -func (b *REST) Update(ctx api.Context, obj runtime.Object) (<-chan apiserver.RESTResult, error) { - return nil, fmt.Errorf("bindings may not be changed.") -} diff --git a/pkg/registry/binding/rest_test.go b/pkg/registry/binding/rest_test.go index 13206ec006e..134d3df5481 100644 --- a/pkg/registry/binding/rest_test.go +++ b/pkg/registry/binding/rest_test.go @@ -24,7 +24,6 @@ import ( "github.com/GoogleCloudPlatform/kubernetes/pkg/api" "github.com/GoogleCloudPlatform/kubernetes/pkg/api/latest" - "github.com/GoogleCloudPlatform/kubernetes/pkg/labels" ) func TestNewREST(t *testing.T) { @@ -51,30 +50,6 @@ func TestNewREST(t *testing.T) { } } -func TestRESTUnsupported(t *testing.T) { - var ctx api.Context - mockRegistry := MockRegistry{ - OnApplyBinding: func(b *api.Binding) error { return nil }, - } - b := NewREST(mockRegistry) - if _, err := b.Delete(ctx, "binding id"); err == nil { - t.Errorf("unexpected non-error") - } - if _, err := b.Update(ctx, &api.Binding{PodID: "foo", Host: "new machine"}); err == nil { - t.Errorf("unexpected non-error") - } - if _, err := b.Get(ctx, "binding id"); err == nil { - t.Errorf("unexpected non-error") - } - if _, err := b.List(ctx, labels.Set{"name": "foo"}.AsSelector(), labels.Everything()); err == nil { - t.Errorf("unexpected non-error") - } - // Try sending wrong object just to get 100% coverage - if _, err := b.Create(ctx, &api.Pod{}); err == nil { - t.Errorf("unexpected non-error") - } -} - func TestRESTPost(t *testing.T) { table := []struct { b *api.Binding diff --git a/pkg/registry/endpoint/rest.go b/pkg/registry/endpoint/rest.go index 3a9d2771c70..40a7831fc23 100644 --- a/pkg/registry/endpoint/rest.go +++ b/pkg/registry/endpoint/rest.go @@ -96,11 +96,6 @@ func (rs *REST) Update(ctx api.Context, obj runtime.Object) (<-chan apiserver.RE }), nil } -// Delete satisfies the RESTStorage interface but is unimplemented. -func (rs *REST) Delete(ctx api.Context, id string) (<-chan apiserver.RESTResult, error) { - return nil, errors.NewBadRequest("Endpoints are read-only") -} - // New implements the RESTStorage interface. func (rs REST) New() runtime.Object { return &api.Endpoints{} diff --git a/pkg/registry/endpoint/rest_test.go b/pkg/registry/endpoint/rest_test.go index 533d6243386..79803c1ce20 100644 --- a/pkg/registry/endpoint/rest_test.go +++ b/pkg/registry/endpoint/rest_test.go @@ -96,14 +96,3 @@ func TestEndpointsRegistryList(t *testing.T) { t.Errorf("Unexpected resource version: %#v", sl) } } - -func TestEndpointsRegistryDelete(t *testing.T) { - registry := registrytest.NewServiceRegistry() - storage := NewREST(registry) - _, err := storage.Delete(api.NewContext(), "n/a") - if err == nil { - t.Error("unexpected non-error") - } else if !errors.IsBadRequest(err) { - t.Errorf("unexpected error: %v", err) - } -} diff --git a/pkg/registry/event/rest.go b/pkg/registry/event/rest.go index 5048a53a49d..8432c09c3d0 100644 --- a/pkg/registry/event/rest.go +++ b/pkg/registry/event/rest.go @@ -131,8 +131,3 @@ func (*REST) New() runtime.Object { func (*REST) NewList() runtime.Object { return &api.EventList{} } - -// Update returns an error: Events are not mutable. -func (rs *REST) Update(ctx api.Context, obj runtime.Object) (<-chan apiserver.RESTResult, error) { - return nil, fmt.Errorf("not allowed: 'Event' objects are not mutable") -} diff --git a/pkg/registry/event/rest_test.go b/pkg/registry/event/rest_test.go index aa73051b7ab..f52e388c259 100644 --- a/pkg/registry/event/rest_test.go +++ b/pkg/registry/event/rest_test.go @@ -172,20 +172,6 @@ func TestRESTgetAttrs(t *testing.T) { } } -func TestRESTUpdate(t *testing.T) { - _, rest := NewTestREST() - eventA := testEvent("foo") - c, err := rest.Create(api.NewDefaultContext(), eventA) - if err != nil { - t.Fatalf("Unexpected error %v", err) - } - <-c - _, err = rest.Update(api.NewDefaultContext(), eventA) - if err == nil { - t.Errorf("unexpected non-error") - } -} - func TestRESTList(t *testing.T) { reg, rest := NewTestREST() eventA := &api.Event{