mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-07 19:23:40 +00:00
Merge pull request #51204 from nikhita/fix-roundtrip-errors
Automatic merge from submit-queue (batch tested with PRs 47115, 51196, 51204, 51208, 51206) roundtrip: fix error messages The error messages had some typos due to which it generated false positives. (encountered in #47263) **Release note**: ```release-note NONE ``` /cc @sttts
This commit is contained in:
commit
761fb34e3d
@ -270,6 +270,12 @@ func roundTrip(t *testing.T, scheme *runtime.Scheme, codec runtime.Codec, object
|
|||||||
// deep copy the original object
|
// deep copy the original object
|
||||||
object = object.DeepCopyObject()
|
object = object.DeepCopyObject()
|
||||||
name := reflect.TypeOf(object).Elem().Name()
|
name := reflect.TypeOf(object).Elem().Name()
|
||||||
|
if !apiequality.Semantic.DeepEqual(original, object) {
|
||||||
|
t.Errorf("%v: DeepCopy altered the object, diff: %v", name, diff.ObjectReflectDiff(original, object))
|
||||||
|
t.Errorf("%s", spew.Sdump(original))
|
||||||
|
t.Errorf("%s", spew.Sdump(object))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
// catch deepcopy errors early
|
// catch deepcopy errors early
|
||||||
if !apiequality.Semantic.DeepEqual(original, object) {
|
if !apiequality.Semantic.DeepEqual(original, object) {
|
||||||
@ -323,7 +329,7 @@ func roundTrip(t *testing.T, scheme *runtime.Scheme, codec runtime.Codec, object
|
|||||||
// ensure that the object produced from decoding the encoded data is equal
|
// ensure that the object produced from decoding the encoded data is equal
|
||||||
// to the original object
|
// to the original object
|
||||||
if !apiequality.Semantic.DeepEqual(original, obj2) {
|
if !apiequality.Semantic.DeepEqual(original, obj2) {
|
||||||
t.Errorf("%v: diff: %v\nCodec: %#v\nSource:\n\n%#v\n\nEncoded:\n\n%s\n\nFinal:\n\n%#v", name, diff.ObjectReflectDiff(object, obj2), codec, printer.Sprintf("%#v", object), dataAsString(data), printer.Sprintf("%#v", obj2))
|
t.Errorf("%v: diff: %v\nCodec: %#v\nSource:\n\n%#v\n\nEncoded:\n\n%s\n\nFinal:\n\n%#v", name, diff.ObjectReflectDiff(original, obj2), codec, printer.Sprintf("%#v", original), dataAsString(data), printer.Sprintf("%#v", obj2))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -370,7 +376,7 @@ func roundTrip(t *testing.T, scheme *runtime.Scheme, codec runtime.Codec, object
|
|||||||
// NOTE: we use the encoding+decoding here as an alternative, guaranteed deep-copy to compare against.
|
// NOTE: we use the encoding+decoding here as an alternative, guaranteed deep-copy to compare against.
|
||||||
fuzzer.ValueFuzz(object)
|
fuzzer.ValueFuzz(object)
|
||||||
if !apiequality.Semantic.DeepEqual(original, obj3) {
|
if !apiequality.Semantic.DeepEqual(original, obj3) {
|
||||||
t.Errorf("%v: fuzzing a copy altered the original, diff: %v", name, diff.ObjectReflectDiff(original, object))
|
t.Errorf("%v: fuzzing a copy altered the original, diff: %v", name, diff.ObjectReflectDiff(original, obj3))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user