Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Flaky: TestControllerSyncFleetAutoscaler #827

Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion pkg/fleetautoscalers/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ type Controller struct {
crdGetter v1beta1.CustomResourceDefinitionInterface
fleetGetter getterv1alpha1.FleetsGetter
fleetLister listerv1alpha1.FleetLister
fleetSynced cache.InformerSynced
fleetAutoscalerGetter getterv1alpha1.FleetAutoscalersGetter
fleetAutoscalerLister listerv1alpha1.FleetAutoscalerLister
fleetAutoscalerSynced cache.InformerSynced
Expand All @@ -77,6 +78,7 @@ func NewController(
crdGetter: extClient.ApiextensionsV1beta1().CustomResourceDefinitions(),
fleetGetter: agonesClient.StableV1alpha1(),
fleetLister: agonesInformer.Fleets().Lister(),
fleetSynced: agonesInformer.Fleets().Informer().HasSynced,
fleetAutoscalerGetter: agonesClient.StableV1alpha1(),
fleetAutoscalerLister: agonesInformer.FleetAutoscalers().Lister(),
fleetAutoscalerSynced: fasInformer.HasSynced,
Expand Down Expand Up @@ -113,7 +115,7 @@ func (c *Controller) Run(workers int, stop <-chan struct{}) error {
}

c.baseLogger.Info("Wait for cache sync")
if !cache.WaitForCacheSync(stop, c.fleetAutoscalerSynced) {
if !cache.WaitForCacheSync(stop, c.fleetSynced, c.fleetAutoscalerSynced) {
return errors.New("failed to wait for caches to sync")
}

Expand Down
8 changes: 4 additions & 4 deletions pkg/fleetautoscalers/controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ func TestControllerSyncFleetAutoscaler(t *testing.T) {
return true, f, nil
})

_, cancel := agtesting.StartInformers(m, c.fleetAutoscalerSynced)
_, cancel := agtesting.StartInformers(m, c.fleetSynced, c.fleetAutoscalerSynced)
defer cancel()

err := c.syncFleetAutoscaler("default/fas-1")
Expand Down Expand Up @@ -214,7 +214,7 @@ func TestControllerSyncFleetAutoscaler(t *testing.T) {
return true, f, nil
})

_, cancel := agtesting.StartInformers(m, c.fleetAutoscalerSynced)
_, cancel := agtesting.StartInformers(m, c.fleetSynced, c.fleetAutoscalerSynced)
defer cancel()

err := c.syncFleetAutoscaler("default/fas-1")
Expand Down Expand Up @@ -251,7 +251,7 @@ func TestControllerSyncFleetAutoscaler(t *testing.T) {
return false, nil, nil
})

_, cancel := agtesting.StartInformers(m, c.fleetAutoscalerSynced)
_, cancel := agtesting.StartInformers(m, c.fleetSynced, c.fleetAutoscalerSynced)
defer cancel()

err := c.syncFleetAutoscaler(fas.ObjectMeta.Name)
Expand Down Expand Up @@ -280,7 +280,7 @@ func TestControllerSyncFleetAutoscaler(t *testing.T) {
return true, fas, nil
})

_, cancel := agtesting.StartInformers(m, c.fleetAutoscalerSynced)
_, cancel := agtesting.StartInformers(m, c.fleetSynced, c.fleetAutoscalerSynced)
defer cancel()

err := c.syncFleetAutoscaler("default/fas-1")
Expand Down