Skip to content

Commit

Permalink
test: replace scale state notifier Register -> `RegisterForNotifica…
Browse files Browse the repository at this point in the history
…tions` in test

- to fix syntax errors since it is already renamed in the actual code
Signed-off-by: vadasambar <[email protected]>
  • Loading branch information
vadasambar committed Dec 19, 2023
1 parent e3930fc commit 8cfc12a
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions cluster-autoscaler/core/scaledown/actuation/actuator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1189,7 +1189,7 @@ func TestStartDeletion(t *testing.T) {
}

scaleStateNotifier := nodegroupchange.NewNodeGroupChangeObserversList()
scaleStateNotifier.Register(csr)
scaleStateNotifier.RegisterForNotifications(csr)

// Create Actuator, run StartDeletion, and verify the error.
ndt := deletiontracker.NewNodeDeletionTracker(0)
Expand Down Expand Up @@ -1429,7 +1429,7 @@ func TestStartDeletionInBatchBasic(t *testing.T) {
}
csr := clusterstate.NewClusterStateRegistry(provider, clusterstate.ClusterStateRegistryConfig{}, ctx.LogRecorder, NewBackoff(), nodegroupconfig.NewDefaultNodeGroupConfigProcessor(config.NodeGroupAutoscalingOptions{MaxNodeProvisionTime: 15 * time.Minute}))
scaleStateNotifier := nodegroupchange.NewNodeGroupChangeObserversList()
scaleStateNotifier.Register(csr)
scaleStateNotifier.RegisterForNotifications(csr)
ndt := deletiontracker.NewNodeDeletionTracker(0)
ndb := NewNodeDeletionBatcher(&ctx, scaleStateNotifier, ndt, deleteInterval)
evictor := Evictor{EvictionRetryTime: 0, DsEvictionRetryTime: 0, DsEvictionEmptyNodeTimeout: 0, PodEvictionHeadroom: DefaultPodEvictionHeadroom}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ func TestRemove(t *testing.T) {
}

scaleStateNotifier := nodegroupchange.NewNodeGroupChangeObserversList()
scaleStateNotifier.Register(clusterStateRegistry)
scaleStateNotifier.RegisterForNotifications(clusterStateRegistry)

ng := "ng"
provider.AddNodeGroup(ng, 1, 10, test.numNodes)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -973,7 +973,7 @@ func runSimpleScaleUpTest(t *testing.T, config *ScaleUpTestConfig) *ScaleUpTestR
clusterState := clusterstate.NewClusterStateRegistry(provider, clusterstate.ClusterStateRegistryConfig{}, context.LogRecorder, NewBackoff(), nodegroupconfig.NewDefaultNodeGroupConfigProcessor(options.NodeGroupDefaults))
clusterState.UpdateNodes(nodes, nodeInfos, time.Now())
processors := NewTestProcessors(&context)
processors.ScaleStateNotifier.Register(clusterState)
processors.ScaleStateNotifier.RegisterForNotifications(clusterState)
orchestrator := New()
orchestrator.Initialize(&context, processors, clusterState, taints.TaintConfig{})
expander := NewMockRepotingStrategy(t, config.ExpansionOptionToChoose)
Expand Down
4 changes: 2 additions & 2 deletions cluster-autoscaler/core/static_autoscaler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -421,14 +421,14 @@ func TestStaticAutoscalerRunOnceWithScaleDownDelayPerNG(t *testing.T) {
}
processors := NewTestProcessors(&context)
sddProcessor := scaledowncandidates.NewScaleDownCandidatesDelayProcessor()
processors.ScaleStateNotifier.Register(sddProcessor)
processors.ScaleStateNotifier.RegisterForNotifications(sddProcessor)
scaleDownCandidatesComparers := []scaledowncandidates.CandidatesComparer{}
processors.ScaleDownNodeProcessor = scaledowncandidates.NewCombinedScaleDownCandidatesProcessor([]nodes.ScaleDownNodeProcessor{
scaledowncandidates.NewScaleDownCandidatesSortingProcessor(scaleDownCandidatesComparers),
sddProcessor,
})
clusterState := clusterstate.NewClusterStateRegistry(provider, clusterStateConfig, context.LogRecorder, NewBackoff(), nodegroupconfig.NewDefaultNodeGroupConfigProcessor(options.NodeGroupDefaults))
processors.ScaleStateNotifier.Register(clusterState)
processors.ScaleStateNotifier.RegisterForNotifications(clusterState)

sdPlanner, sdActuator := newScaleDownPlannerAndActuator(t, &context, processors, clusterState)
suOrchestrator := orchestrator.New()
Expand Down

0 comments on commit 8cfc12a

Please sign in to comment.