Skip to content

Commit

Permalink
add missing HasSynced method
Browse files Browse the repository at this point in the history
Signed-off-by: Tim Ramlot <42113979+inteon@users.noreply.github.com>
  • Loading branch information
inteon committed May 4, 2023
1 parent 9654963 commit 8114ff5
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions pkg/controller/controllertest/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ type legacyResourceEventHandler interface {
// eventHandlerWrapper wraps a ResourceEventHandler in a manner that is compatible with client-go 1.27+ and older.
// The interface was changed in these versions.
type eventHandlerWrapper struct {
handler any
handler any
hasSynced bool
}

func (e eventHandlerWrapper) OnAdd(obj interface{}) {
Expand All @@ -81,6 +82,10 @@ func (e eventHandlerWrapper) OnDelete(obj interface{}) {
e.handler.(legacyResourceEventHandler).OnDelete(obj)
}

func (e eventHandlerWrapper) HasSynced() bool {
return e.hasSynced
}

// AddIndexers does nothing. TODO(community): Implement this.
func (f *FakeInformer) AddIndexers(indexers cache.Indexers) error {
return nil
Expand All @@ -105,7 +110,7 @@ func (f *FakeInformer) HasSynced() bool {
func (f *FakeInformer) AddEventHandler(handler cache.ResourceEventHandler) (cache.ResourceEventHandlerRegistration, error) {
f.mu.Lock()
defer f.mu.Unlock()
eh := &eventHandlerWrapper{handler}
eh := &eventHandlerWrapper{handler, true}
f.handlers = append(f.handlers, eh)
return eh, nil
}
Expand Down

0 comments on commit 8114ff5

Please sign in to comment.