Replace uses of ObjectGoPrintDiff with cmp.Diff

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

Kubernetes-commit: 9627c50ef37f3b5274486e6f5ad37b73b1b69bf0
This commit is contained in:
Tim Hockin
2023-03-23 11:31:25 -07:00
committed by Kubernetes Publisher
parent 7114041b4f
commit c4339eeca9
3 changed files with 11 additions and 12 deletions

View File

@@ -28,7 +28,6 @@ import (
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/apimachinery/pkg/types"
"k8s.io/apimachinery/pkg/util/diff"
)
const (
@@ -80,7 +79,7 @@ func TestGet(t *testing.T) {
},
}
if !equality.Semantic.DeepEqual(get, expected) {
t.Fatal(diff.ObjectGoPrintDiff(expected, get))
t.Fatal(cmp.Diff(expected, get))
}
}
@@ -99,7 +98,7 @@ func TestListDecoding(t *testing.T) {
Items: []unstructured.Unstructured{},
}
if !equality.Semantic.DeepEqual(list, expectedList) {
t.Fatal(diff.ObjectGoPrintDiff(expectedList, list))
t.Fatal(cmp.Diff(expectedList, list))
}
}
@@ -117,7 +116,7 @@ func TestGetDecoding(t *testing.T) {
},
}
if !equality.Semantic.DeepEqual(get, expectedObj) {
t.Fatal(diff.ObjectGoPrintDiff(expectedObj, get))
t.Fatal(cmp.Diff(expectedObj, get))
}
}
@@ -145,7 +144,7 @@ func TestList(t *testing.T) {
*newUnstructured("group/version", "TheKind", "ns-foo", "name-foo"),
}
if !equality.Semantic.DeepEqual(listFirst.Items, expected) {
t.Fatal(diff.ObjectGoPrintDiff(expected, listFirst.Items))
t.Fatal(cmp.Diff(expected, listFirst.Items))
}
}
@@ -189,7 +188,7 @@ func Test_ListKind(t *testing.T) {
},
}
if !equality.Semantic.DeepEqual(listFirst, expectedList) {
t.Fatal(diff.ObjectGoPrintDiff(expectedList, listFirst))
t.Fatal(cmp.Diff(expectedList, listFirst))
}
}
@@ -242,7 +241,7 @@ func (tc *patchTestCase) verifyResult(result *unstructured.Unstructured) error {
return nil
}
if !equality.Semantic.DeepEqual(result, tc.expectedPatchedObject) {
return fmt.Errorf("unexpected diff in received object: %s", diff.ObjectGoPrintDiff(tc.expectedPatchedObject, result))
return fmt.Errorf("unexpected diff in received object: %s", cmp.Diff(tc.expectedPatchedObject, result))
}
return nil
}