Skip to content

Commit

Permalink
Make backoff.Status.ErrorInfo non-pointer.
Browse files Browse the repository at this point in the history
Change-Id: I1f812d4d6f42db97670ef7304fc0e895c837a13b
  • Loading branch information
walidghallab committed Dec 14, 2023
1 parent f0001eb commit f89427a
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions cluster-autoscaler/clusterstate/clusterstate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -928,7 +928,7 @@ func TestScaleUpBackoff(t *testing.T) {
Healthy: true,
BackoffStatus: backoff.Status{
IsBackedOff: true,
ErrorInfo: &cloudprovider.InstanceErrorInfo{
ErrorInfo: cloudprovider.InstanceErrorInfo{
ErrorClass: cloudprovider.OtherErrorClass,
ErrorCode: "timeout",
ErrorMessage: "Scale-up timed out for node group ng1 after 3m0s",
Expand All @@ -937,7 +937,7 @@ func TestScaleUpBackoff(t *testing.T) {
}, clusterstate.IsNodeGroupSafeToScaleUp(ng1, now))
assert.Equal(t, backoff.Status{
IsBackedOff: true,
ErrorInfo: &cloudprovider.InstanceErrorInfo{
ErrorInfo: cloudprovider.InstanceErrorInfo{
ErrorClass: cloudprovider.OtherErrorClass,
ErrorCode: "timeout",
ErrorMessage: "Scale-up timed out for node group ng1 after 3m0s",
Expand All @@ -961,7 +961,7 @@ func TestScaleUpBackoff(t *testing.T) {
Healthy: true,
BackoffStatus: backoff.Status{
IsBackedOff: true,
ErrorInfo: &cloudprovider.InstanceErrorInfo{
ErrorInfo: cloudprovider.InstanceErrorInfo{
ErrorClass: cloudprovider.OtherErrorClass,
ErrorCode: "timeout",
ErrorMessage: "Scale-up timed out for node group ng1 after 2m1s",
Expand All @@ -975,7 +975,7 @@ func TestScaleUpBackoff(t *testing.T) {
Healthy: true,
BackoffStatus: backoff.Status{
IsBackedOff: true,
ErrorInfo: &cloudprovider.InstanceErrorInfo{
ErrorInfo: cloudprovider.InstanceErrorInfo{
ErrorClass: cloudprovider.OtherErrorClass,
ErrorCode: "timeout",
ErrorMessage: "Scale-up timed out for node group ng1 after 2m1s",
Expand Down
2 changes: 1 addition & 1 deletion cluster-autoscaler/utils/backoff/backoff.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import (
// Status contains information about back off status.
type Status struct {
IsBackedOff bool
ErrorInfo *cloudprovider.InstanceErrorInfo
ErrorInfo cloudprovider.InstanceErrorInfo
}

// Backoff allows time-based backing off of node groups considered in scale up algorithm
Expand Down
2 changes: 1 addition & 1 deletion cluster-autoscaler/utils/backoff/exponential_backoff.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ func (b *exponentialBackoff) BackoffStatus(nodeGroup cloudprovider.NodeGroup, no
}
return Status{
IsBackedOff: true,
ErrorInfo: &backoffInfo.errorInfo,
ErrorInfo: backoffInfo.errorInfo,
}
}

Expand Down
4 changes: 2 additions & 2 deletions cluster-autoscaler/utils/backoff/exponential_backoff_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,11 @@ var ipSpaceExhaustedError = cloudprovider.InstanceErrorInfo{ErrorClass: cloudpro
var noBackOff = Status{IsBackedOff: false}
var backoffWithQuotaError = Status{
IsBackedOff: true,
ErrorInfo: &quotaError,
ErrorInfo: quotaError,
}
var backoffWithIpSpaceExhaustedError = Status{
IsBackedOff: true,
ErrorInfo: &ipSpaceExhaustedError,
ErrorInfo: ipSpaceExhaustedError,
}

func TestBackoffTwoKeys(t *testing.T) {
Expand Down

0 comments on commit f89427a

Please sign in to comment.