From 17606603d25e0a692329a0affdd388326fb9ff53 Mon Sep 17 00:00:00 2001 From: Wojciech Tyczynski Date: Fri, 25 Nov 2016 14:50:40 +0100 Subject: [PATCH] Fix TestServiceAlloc flakes --- pkg/registry/core/service/ipallocator/controller/repair.go | 2 +- pkg/registry/core/service/portallocator/controller/repair.go | 2 +- pkg/registry/generic/registry/store.go | 3 ++- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/pkg/registry/core/service/ipallocator/controller/repair.go b/pkg/registry/core/service/ipallocator/controller/repair.go index de323fbc776..e06ef571ff1 100644 --- a/pkg/registry/core/service/ipallocator/controller/repair.go +++ b/pkg/registry/core/service/ipallocator/controller/repair.go @@ -105,7 +105,7 @@ func (c *Repair) runOnce() error { // the service collection. The caching layer keeps per-collection RVs, // and this is proper, since in theory the collections could be hosted // in separate etcd (or even non-etcd) instances. - list, err := c.registry.ListServices(ctx, nil) + list, err := c.registry.ListServices(ctx, &api.ListOptions{}) if err != nil { return fmt.Errorf("unable to refresh the service IP block: %v", err) } diff --git a/pkg/registry/core/service/portallocator/controller/repair.go b/pkg/registry/core/service/portallocator/controller/repair.go index 4d5cb51914d..5ad15c3294f 100644 --- a/pkg/registry/core/service/portallocator/controller/repair.go +++ b/pkg/registry/core/service/portallocator/controller/repair.go @@ -94,7 +94,7 @@ func (c *Repair) runOnce() error { // the service collection. The caching layer keeps per-collection RVs, // and this is proper, since in theory the collections could be hosted // in separate etcd (or even non-etcd) instances. - list, err := c.registry.ListServices(ctx, nil) + list, err := c.registry.ListServices(ctx, &api.ListOptions{}) if err != nil { return fmt.Errorf("unable to refresh the port block: %v", err) } diff --git a/pkg/registry/generic/registry/store.go b/pkg/registry/generic/registry/store.go index 1986e705859..b1160993f55 100644 --- a/pkg/registry/generic/registry/store.go +++ b/pkg/registry/generic/registry/store.go @@ -203,7 +203,8 @@ func (e *Store) List(ctx api.Context, options *api.ListOptions) (runtime.Object, // ListPredicate returns a list of all the items matching m. func (e *Store) ListPredicate(ctx api.Context, p storage.SelectionPredicate, options *api.ListOptions) (runtime.Object, error) { if options == nil { - options = &api.ListOptions{ResourceVersion: "0"} + // By default we should serve the request from etcd. + options = &api.ListOptions{ResourceVersion: ""} } list := e.NewListFunc() if name, ok := p.MatchesSingle(); ok {