apimachinery: fail early with deepcopy problems during roundtrip tests
This commit is contained in:
		@@ -276,6 +276,12 @@ func roundTrip(t *testing.T, scheme *runtime.Scheme, codec runtime.Codec, object
 | 
				
			|||||||
	object = copied.(runtime.Object)
 | 
						object = copied.(runtime.Object)
 | 
				
			||||||
	name := reflect.TypeOf(object).Elem().Name()
 | 
						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
 | 
						// encode (serialize) the deep copy using the provided codec
 | 
				
			||||||
	data, err := runtime.Encode(codec, object)
 | 
						data, err := runtime.Encode(codec, object)
 | 
				
			||||||
	if err != nil {
 | 
						if err != nil {
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user