Merge pull request #82104 from klueska/upstream-fix-cpu-manager-topology-bug

Fix bug in CPUManager with setting topology for policies
This commit is contained in:
Kubernetes Prow Robot 2019-08-30 08:00:44 -07:00 committed by GitHub
commit 9165f7bf56
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 1 deletions

View File

@ -113,7 +113,7 @@ func NewManager(cpuPolicyName string, reconcilePeriod time.Duration, machineInfo
case PolicyStatic:
var err error
topo, err := topology.Discover(machineInfo, numaNodeInfo)
topo, err = topology.Discover(machineInfo, numaNodeInfo)
if err != nil {
return nil, err
}

View File

@ -353,6 +353,16 @@ func TestCPUManagerGenerate(t *testing.T) {
if 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)
}
}
}
})