cpumanager: topology: use rich cmp package

User the `cmp.Diff` package in the unit tests, moving away from
`reflect.DeepEqual`. This gives us a clearer picture of the differences
when the tests fail.

Signed-off-by: Francesco Romani <fromani@redhat.com>
This commit is contained in:
Francesco Romani 2021-10-14 16:46:16 +02:00 committed by Kevin Klues
parent aff54a0914
commit 15caa134b2

View File

@ -21,6 +21,7 @@ import (
"testing"
cadvisorapi "github.com/google/cadvisor/info/v1"
"github.com/google/go-cmp/cmp"
"k8s.io/kubernetes/pkg/kubelet/cm/cpuset"
)
@ -202,8 +203,8 @@ func Test_Discover(t *testing.T) {
}
return
}
if !reflect.DeepEqual(got, tt.want) {
t.Errorf("Discover() = %v, want %v", got, tt.want)
if diff := cmp.Diff(got, tt.want); diff != "" {
t.Errorf("Discover() = %v, want %v diff=%s", got, tt.want, diff)
}
})
}