mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-25 20:53:33 +00:00
Fix bug in CPUManager with setting topology for policies
Also add a check in the unit tests to avoid regressions
This commit is contained in:
parent
d7ecc85239
commit
ddfd9ac0ca
@ -113,7 +113,7 @@ func NewManager(cpuPolicyName string, reconcilePeriod time.Duration, machineInfo
|
|||||||
|
|
||||||
case PolicyStatic:
|
case PolicyStatic:
|
||||||
var err error
|
var err error
|
||||||
topo, err := topology.Discover(machineInfo, numaNodeInfo)
|
topo, err = topology.Discover(machineInfo, numaNodeInfo)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
@ -353,6 +353,16 @@ func TestCPUManagerGenerate(t *testing.T) {
|
|||||||
if rawMgr.policy.Name() != testCase.expectedPolicy {
|
if rawMgr.policy.Name() != testCase.expectedPolicy {
|
||||||
t.Errorf("Unexpected policy name. Have: %q wants %q", rawMgr.policy.Name(), testCase.expectedPolicy)
|
t.Errorf("Unexpected policy name. Have: %q wants %q", rawMgr.policy.Name(), testCase.expectedPolicy)
|
||||||
}
|
}
|
||||||
|
if rawMgr.policy.Name() == string(PolicyNone) {
|
||||||
|
if rawMgr.topology != nil {
|
||||||
|
t.Errorf("Expected topology to be nil for 'none' policy. Have: %q", rawMgr.topology)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if rawMgr.policy.Name() != string(PolicyNone) {
|
||||||
|
if rawMgr.topology == nil {
|
||||||
|
t.Errorf("Expected topology to be non-nil for policy '%v'. Have: %q", rawMgr.policy.Name(), rawMgr.topology)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user