Update filterHints to filterSingleNumaHints:

- Change function name
- Remove policy parameter (unnecessary)
- Update unit test to reflect change
This commit is contained in:
nolancon 2020-01-22 07:15:00 +00:00
parent 3d8317ae91
commit df9b2595f3
2 changed files with 3 additions and 5 deletions

View File

@ -55,7 +55,7 @@ func (p *singleNumaNodePolicy) canAdmitPodResult(hint *TopologyHint) lifecycle.P
}
// Return hints that have valid bitmasks with exactly one bit set.
func (p *singleNumaNodePolicy) filterHints(allResourcesHints [][]TopologyHint) [][]TopologyHint {
func filterSingleNumaHints(allResourcesHints [][]TopologyHint) [][]TopologyHint {
var filteredResourcesHints [][]TopologyHint
for _, oneResourceHints := range allResourcesHints {
var filtered []TopologyHint
@ -108,7 +108,7 @@ func (p *singleNumaNodePolicy) mergeProvidersHints(providersHints []map[string][
}
// Filter to only include don't cares and hints with a single NUMA node.
allProviderHints = p.filterHints(allProviderHints)
allProviderHints = filterSingleNumaHints(allProviderHints)
// Set the bestHint to return from this function as {nil false}.
// This will only be returned if no better hint can be found when

View File

@ -155,10 +155,8 @@ func TestPolicySingleNumaNodeFilterHints(t *testing.T) {
},
}
numaNodes := []int{0, 1, 2, 3}
for _, tc := range tcases {
policy := NewSingleNumaNodePolicy(numaNodes)
actual := policy.(*singleNumaNodePolicy).filterHints(tc.allResources)
actual := filterSingleNumaHints(tc.allResources)
if !reflect.DeepEqual(tc.expectedResources, actual) {
t.Errorf("Test Case: %s", tc.name)
t.Errorf("Expected result to be %v, got %v", tc.expectedResources, actual)