mirror of
https://github.com/vmware-tanzu/pinniped.git
synced 2026-01-03 11:45:45 +00:00
kubecertagent: fix flakey tests
This commit makes the following changes to the kube cert agent tests: 1. Informers are synced on start using the controllerinit code 2. Deployment client and informer are synced per controller sync loop 3. Controller sync loop exits after two consistent errors 4. Use assert instead of require to avoid ending the test early Signed-off-by: Monis Khan <mok@vmware.com>
This commit is contained in:
@@ -22,8 +22,8 @@ type RunnerWrapper func(context.Context, Runner)
|
||||
// It is expected to be called in the main go routine since the construction can fail.
|
||||
type RunnerBuilder func(context.Context) (Runner, error)
|
||||
|
||||
// informer is the subset of SharedInformerFactory needed for starting an informer cache and waiting for it to sync.
|
||||
type informer interface {
|
||||
// Informer is the subset of SharedInformerFactory needed for starting an informer cache and waiting for it to sync.
|
||||
type Informer interface {
|
||||
Start(stopCh <-chan struct{})
|
||||
WaitForCacheSync(stopCh <-chan struct{}) map[reflect.Type]bool
|
||||
}
|
||||
@@ -31,7 +31,7 @@ type informer interface {
|
||||
// Prepare returns RunnerBuilder that, when called:
|
||||
// 1. Starts all provided informers and waits for them sync (and fails if they hang)
|
||||
// 2. Returns a Runner that combines the Runner and RunnerWrapper passed into Prepare
|
||||
func Prepare(controllers Runner, controllersWrapper RunnerWrapper, informers ...informer) RunnerBuilder {
|
||||
func Prepare(controllers Runner, controllersWrapper RunnerWrapper, informers ...Informer) RunnerBuilder {
|
||||
return func(ctx context.Context) (Runner, error) {
|
||||
for _, informer := range informers {
|
||||
informer := informer
|
||||
|
||||
Reference in New Issue
Block a user