Add field selector to List, implement for pods.

This commit is contained in:
Daniel Smith
2014-09-16 16:15:40 -07:00
parent 3f659f7d74
commit 4e9cf2ccb4
18 changed files with 153 additions and 39 deletions

View File

@@ -43,9 +43,9 @@ func (rs *REST) Get(id string) (runtime.Object, error) {
}
// List satisfies the RESTStorage interface.
func (rs *REST) List(selector labels.Selector) (runtime.Object, error) {
if !selector.Empty() {
return nil, errors.New("label selectors are not supported on endpoints")
func (rs *REST) List(label, field labels.Selector) (runtime.Object, error) {
if !label.Empty() || !field.Empty() {
return nil, errors.New("label/field selectors are not supported on endpoints")
}
return rs.registry.ListEndpoints()
}

View File

@@ -79,7 +79,7 @@ func TestEndpointsRegistryList(t *testing.T) {
{JSONBase: api.JSONBase{ID: "bar"}},
},
}
s, _ := storage.List(labels.Everything())
s, _ := storage.List(labels.Everything(), labels.Everything())
sl := s.(*api.EndpointsList)
if len(sl.Items) != 2 {
t.Fatalf("Expected 2 endpoints, but got %v", len(sl.Items))