Replace uses of ObjectReflectDiff with cmp.Diff

ObjectReflectDiff is already a shim over cmp.Diff, so no actual output
or behavior changes

Kubernetes-commit: bc302fa4144d21a338683cd83701661f97be4aba
This commit is contained in:
Tim Hockin
2023-03-23 11:34:03 -07:00
committed by Kubernetes Publisher
parent c4339eeca9
commit 12553015e2
8 changed files with 20 additions and 22 deletions

View File

@@ -45,7 +45,6 @@ import (
"k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/apimachinery/pkg/runtime/serializer"
"k8s.io/apimachinery/pkg/runtime/serializer/streaming"
"k8s.io/apimachinery/pkg/util/diff"
"k8s.io/apimachinery/pkg/util/intstr"
utilnet "k8s.io/apimachinery/pkg/util/net"
"k8s.io/apimachinery/pkg/watch"
@@ -925,22 +924,22 @@ func TestTransformUnstructuredError(t *testing.T) {
expect = err
}
if !reflect.DeepEqual(expect, transformed) {
t.Errorf("unexpected Error(): %s", diff.ObjectReflectDiff(expect, transformed))
t.Errorf("unexpected Error(): %s", cmp.Diff(expect, transformed))
}
// verify result.Get properly transforms the error
if _, err := result.Get(); !reflect.DeepEqual(expect, err) {
t.Errorf("unexpected error on Get(): %s", diff.ObjectReflectDiff(expect, err))
t.Errorf("unexpected error on Get(): %s", cmp.Diff(expect, err))
}
// verify result.Into properly handles the error
if err := result.Into(&v1.Pod{}); !reflect.DeepEqual(expect, err) {
t.Errorf("unexpected error on Into(): %s", diff.ObjectReflectDiff(expect, err))
t.Errorf("unexpected error on Into(): %s", cmp.Diff(expect, err))
}
// verify result.Raw leaves the error in the untransformed state
if _, err := result.Raw(); !reflect.DeepEqual(result.err, err) {
t.Errorf("unexpected error on Raw(): %s", diff.ObjectReflectDiff(expect, err))
t.Errorf("unexpected error on Raw(): %s", cmp.Diff(expect, err))
}
})
}
@@ -1220,7 +1219,7 @@ func TestRequestWatch(t *testing.T) {
t.Fatalf("Watch closed early, %d/%d read", i, len(testCase.Expect))
}
if !reflect.DeepEqual(evt, out) {
t.Fatalf("Event %d does not match: %s", i, diff.ObjectReflectDiff(evt, out))
t.Fatalf("Event %d does not match: %s", i, cmp.Diff(evt, out))
}
}
}