ContainerImage.Pinniped/internal/controllerlib/option_test.go
Matt Moyer a503fa8673 Pull controller-go back into this repository as internal/controllerlib.
Signed-off-by: Matt Moyer <moyerm@vmware.com>
2020-08-28 13:07:47 -05:00

28 lines
460 B
Go

/*
Copyright 2020 VMware, Inc.
SPDX-License-Identifier: Apache-2.0
*/
package controllerlib
import (
"testing"
"k8s.io/client-go/tools/cache"
)
type getter bool
func (g *getter) Informer() cache.SharedIndexInformer {
*g = true
return nil
}
func TestInformerCalled(t *testing.T) {
g := getter(false)
_ = New(Config{}, WithInformer(&g, FilterByNames(nil), InformerOption{}))
if !g {
t.Error("expected InformerGetter.Informer() to be called")
}
}