mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-10 04:27:54 +00:00
topologymanager: Increase TopologyManager test coverage by adding negative test cases around NUMA topology discovery
Signed-off-by: PiotrProkop <pprokop@nvidia.com>
This commit is contained in:
parent
998654e044
commit
23833b9c81
@ -42,6 +42,7 @@ func TestNewManager(t *testing.T) {
|
|||||||
expectedError error
|
expectedError error
|
||||||
topologyError error
|
topologyError error
|
||||||
policyOptions map[string]string
|
policyOptions map[string]string
|
||||||
|
topology []cadvisorapi.Node
|
||||||
}{
|
}{
|
||||||
{
|
{
|
||||||
description: "Policy is set to none",
|
description: "Policy is set to none",
|
||||||
@ -86,10 +87,59 @@ func TestNewManager(t *testing.T) {
|
|||||||
"unknown-option": "true",
|
"unknown-option": "true",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
description: "can't get NUMA distances",
|
||||||
|
policyName: "best-effort",
|
||||||
|
expectedPolicy: "best-effort",
|
||||||
|
policyOptions: map[string]string{
|
||||||
|
PreferClosestNUMANodes: "true",
|
||||||
|
},
|
||||||
|
expectedError: fmt.Errorf("error getting NUMA distances from cadvisor"),
|
||||||
|
topology: []cadvisorapi.Node{
|
||||||
|
{
|
||||||
|
Id: 0,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
description: "more than 8 NUMA nodes",
|
||||||
|
policyName: "best-effort",
|
||||||
|
expectedPolicy: "best-effort",
|
||||||
|
expectedError: fmt.Errorf("unsupported on machines with more than %v NUMA Nodes", maxAllowableNUMANodes),
|
||||||
|
topology: []cadvisorapi.Node{
|
||||||
|
{
|
||||||
|
Id: 0,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Id: 1,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Id: 2,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Id: 3,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Id: 4,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Id: 5,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Id: 6,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Id: 7,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Id: 8,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, tc := range tcases {
|
for _, tc := range tcases {
|
||||||
topology := []cadvisorapi.Node{}
|
topology := tc.topology
|
||||||
|
|
||||||
mngr, err := NewManager(topology, tc.policyName, "container", tc.policyOptions)
|
mngr, err := NewManager(topology, tc.policyName, "container", tc.policyOptions)
|
||||||
if tc.expectedError != nil {
|
if tc.expectedError != nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user