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

fix: address NaN output in weight interpolation #883

Closed
wants to merge 4 commits into from

Conversation

michaelawyu
Copy link
Contributor

Description of your changes

This PR fixes an issue where weight interpolation will yield a NaN value when a property is of the same value across the fleet.

I have:

  • Run make reviewable to ensure this PR is ready for review.

How has this code been tested

  • Integration tests
  • E2E tests

Special notes for your reviewer

Unit tests for the file have not been checked in before; will submit a separate PR.

@@ -245,6 +245,16 @@ func interpolateWeightFor(cluster *clusterv1beta1.MemberCluster, property string
return 0, fmt.Errorf("cannot interpolate weight, observed value %v, observed min %v, observed max %v", f, minF, maxF)
}

if minF == maxF {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is there a test case for this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi Ryan! I have moved some UTs from another PR to this one for review purposes. The UTs for types.go were not checked in earlier 😣

@michaelawyu
Copy link
Contributor Author

Note: the fix itself has been checked in with an earlier PR; closing this one as its content has been included in #887.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants