Merge pull request #108682 from chymy/nilpointer

Method call 'err.Error()' might lead to a nil pointer dereference for pkg/kubelet/cm/cpumanager/cpu_assignment_test.go
This commit is contained in:
Kubernetes Prow Robot
2022-06-27 19:15:56 -07:00
committed by GitHub

View File

@@ -656,7 +656,7 @@ func TestTakeByTopologyNUMAPacked(t *testing.T) {
for _, tc := range testCases {
t.Run(tc.description, func(t *testing.T) {
result, err := takeByTopologyNUMAPacked(tc.topo, tc.availableCPUs, tc.numCPUs)
if tc.expErr != "" && err.Error() != tc.expErr {
if tc.expErr != "" && err != nil && err.Error() != tc.expErr {
t.Errorf("expected error to be [%v] but it was [%v]", tc.expErr, err)
}
if !result.Equals(tc.expResult) {