Skip to content

Commit

Permalink
Don't call cmp in non-testing file
Browse files Browse the repository at this point in the history
  • Loading branch information
zasweq committed May 16, 2022
1 parent d9b952b commit 25ef837
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions xds/internal/balancer/outlierdetection/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ package outlierdetection
import (
"time"

"github.com/google/go-cmp/cmp"
internalserviceconfig "google.golang.org/grpc/internal/serviceconfig"
"google.golang.org/grpc/serviceconfig"
)
Expand Down Expand Up @@ -154,7 +153,9 @@ type LBConfig struct {
ChildPolicy *internalserviceconfig.BalancerConfig `json:"childPolicy,omitempty"`
}

// Equal returns whether the LBConfig is the same with the parameter.
// Equal returns whether the LBConfig is the same with the parameter, outside of
// the child policy. The child policy will need to be manually compared in tests
// (to avoid cmp in this non-testing file).
func (lbc *LBConfig) Equal(lbc2 *LBConfig) bool {
if lbc == nil && lbc2 == nil {
return true
Expand All @@ -177,8 +178,5 @@ func (lbc *LBConfig) Equal(lbc2 *LBConfig) bool {
if !lbc.SuccessRateEjection.Equal(lbc2.SuccessRateEjection) {
return false
}
if !lbc.FailurePercentageEjection.Equal(lbc2.FailurePercentageEjection) {
return false
}
return cmp.Equal(lbc.ChildPolicy, lbc2.ChildPolicy)
return lbc.FailurePercentageEjection.Equal(lbc2.FailurePercentageEjection)
}

0 comments on commit 25ef837

Please sign in to comment.