Fix comment and assert score in test case

This commit is contained in:
Preetha Appan 2019-05-15 12:35:57 -05:00
parent f0b9f8e37a
commit 374eee421f
No known key found for this signature in database
GPG Key ID: 9F7C19990A50EAFC
2 changed files with 3 additions and 1 deletions

View File

@ -215,7 +215,8 @@ func evenSpreadScoreBoost(pset *propertySet, option *structs.Node) float64 {
// Maximum possible penalty when the distribution is even
return -1.0
} else if minCount == 0 {
// Maximum possible boost
// Current attribute count is equal to min and both are zero. This means no allocations
// were placed for this attribute value yet. Should get the maximum possible boost.
return 1.0
}

View File

@ -566,4 +566,5 @@ func Test_evenSpreadScoreBoost(t *testing.T) {
}
boost := evenSpreadScoreBoost(pset, opt)
require.False(t, math.IsInf(boost, 1))
require.Equal(t, 1.0, boost)
}