Merge pull request #125835 from benluddy/roundtrip-error-fmt-strings

Fix fmt verbs for strings in roundtrip test errors
This commit is contained in:
Kubernetes Prow Robot
2024-07-06 05:02:53 -07:00
committed by GitHub

View File

@@ -350,14 +350,14 @@ func roundTrip(t *testing.T, scheme *runtime.Scheme, codec runtime.Codec, object
// decode (deserialize) the encoded data back into an object // decode (deserialize) the encoded data back into an object
obj2, err := runtime.Decode(codec, data) obj2, err := runtime.Decode(codec, data)
if err != nil { if err != nil {
t.Errorf("%v: %v\nCodec: %#v\nData: %s\nSource: %#v", name, err, codec, dataAsString(data), dump.Pretty(object)) t.Errorf("%v: %v\nCodec: %#v\nData: %s\nSource: %s", name, err, codec, dataAsString(data), dump.Pretty(object))
panic("failed") panic("failed")
} }
// 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, cmp.Diff(original, obj2), codec, dump.Pretty(original), dataAsString(data), dump.Pretty(obj2)) t.Errorf("%v: diff: %v\nCodec: %#v\nSource:\n\n%s\n\nEncoded:\n\n%s\n\nFinal:\n\n%s", name, cmp.Diff(original, obj2), codec, dump.Pretty(original), dataAsString(data), dump.Pretty(obj2))
return return
} }