mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-29 14:37:00 +00:00
Merge pull request #49474 from sttts/sttts-roundtrip-deepcopy
Automatic merge from submit-queue (batch tested with PRs 48976, 49474, 40050, 49426, 49430) apimachinery: fail early with deepcopy problems during roundtrip tests If deepcopy is broken for some type, it's easy to diagnose. This PR let's the roundtrip test to fail early in this case.
This commit is contained in:
commit
636984dcdd
@ -276,6 +276,12 @@ func roundTrip(t *testing.T, scheme *runtime.Scheme, codec runtime.Codec, object
|
||||
object = copied.(runtime.Object)
|
||||
name := reflect.TypeOf(object).Elem().Name()
|
||||
|
||||
// catch deepcopy errors early
|
||||
if !apiequality.Semantic.DeepEqual(original, object) {
|
||||
t.Errorf("%v: DeepCopy did not lead to equal object, diff: %v", name, diff.ObjectReflectDiff(original, object))
|
||||
return
|
||||
}
|
||||
|
||||
// encode (serialize) the deep copy using the provided codec
|
||||
data, err := runtime.Encode(codec, object)
|
||||
if err != nil {
|
||||
|
Loading…
Reference in New Issue
Block a user