Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
willie-yao committed Mar 26, 2024
1 parent e752ee8 commit 387c56e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
5 changes: 2 additions & 3 deletions test/e2e/autoscaler.go
Original file line number Diff line number Diff line change
Expand Up @@ -224,11 +224,10 @@ func AutoscalerSpec(ctx context.Context, inputGetter func() AutoscalerSpecInput)
WaitForAnnotationsToBeDropped: input.E2EConfig.GetIntervals(specName, "wait-controllers"),
})

By("Deleting the scale up deployment")
framework.DeleteScaleUpDeployment(ctx, framework.DeleteScaleUpDeploymentInput{
By("Deleting the MachineDeployment scale up deployment")
framework.DeleteScaleUpDeploymentAndWait(ctx, framework.DeleteScaleUpDeploymentAndWaitInput{
ClusterProxy: workloadClusterProxy,
WaitForDelete: input.E2EConfig.GetIntervals(specName, "wait-autoscaler"),
Name: "scale-up",
})

By("Enabling autoscaler for the MachinePool")
Expand Down
10 changes: 7 additions & 3 deletions test/framework/autoscaler_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -220,15 +220,19 @@ func AddScaleUpDeploymentAndWait(ctx context.Context, input AddScaleUpDeployment
}, intervals...)
}

type DeleteScaleUpDeploymentInput struct {
type DeleteScaleUpDeploymentAndWaitInput struct {
ClusterProxy ClusterProxy
Name string
WaitForDelete []interface{}
}

func DeleteScaleUpDeployment(ctx context.Context, input DeleteScaleUpDeploymentInput) error {
// Get the deployment
func DeleteScaleUpDeploymentAndWait(ctx context.Context, input DeleteScaleUpDeploymentAndWaitInput) error {
By("Retrieving the scale up deployment")
deployment := &appsv1.Deployment{}
deploymentName := input.Name
if deploymentName == "" {
deploymentName = "scale-up"
}
err := input.ClusterProxy.GetClient().Get(ctx, client.ObjectKey{Name: input.Name, Namespace: metav1.NamespaceDefault}, deployment)
if err != nil {
return err
Expand Down

0 comments on commit 387c56e

Please sign in to comment.