mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-01 07:47:56 +00:00
Update filterHints to filterSingleNumaHints:
- Change function name - Remove policy parameter (unnecessary) - Update unit test to reflect change
This commit is contained in:
parent
3d8317ae91
commit
df9b2595f3
@ -55,7 +55,7 @@ func (p *singleNumaNodePolicy) canAdmitPodResult(hint *TopologyHint) lifecycle.P
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Return hints that have valid bitmasks with exactly one bit set.
|
// 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
|
var filteredResourcesHints [][]TopologyHint
|
||||||
for _, oneResourceHints := range allResourcesHints {
|
for _, oneResourceHints := range allResourcesHints {
|
||||||
var filtered []TopologyHint
|
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.
|
// 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}.
|
// Set the bestHint to return from this function as {nil false}.
|
||||||
// This will only be returned if no better hint can be found when
|
// This will only be returned if no better hint can be found when
|
||||||
|
@ -155,10 +155,8 @@ func TestPolicySingleNumaNodeFilterHints(t *testing.T) {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
numaNodes := []int{0, 1, 2, 3}
|
|
||||||
for _, tc := range tcases {
|
for _, tc := range tcases {
|
||||||
policy := NewSingleNumaNodePolicy(numaNodes)
|
actual := filterSingleNumaHints(tc.allResources)
|
||||||
actual := policy.(*singleNumaNodePolicy).filterHints(tc.allResources)
|
|
||||||
if !reflect.DeepEqual(tc.expectedResources, actual) {
|
if !reflect.DeepEqual(tc.expectedResources, actual) {
|
||||||
t.Errorf("Test Case: %s", tc.name)
|
t.Errorf("Test Case: %s", tc.name)
|
||||||
t.Errorf("Expected result to be %v, got %v", tc.expectedResources, actual)
|
t.Errorf("Expected result to be %v, got %v", tc.expectedResources, actual)
|
||||||
|
Loading…
Reference in New Issue
Block a user