mirror of
				https://github.com/optim-enterprises-bv/kubernetes.git
				synced 2025-11-03 19:58:17 +00:00 
			
		
		
		
	Use cmp.Diff instead of diff.Object* in pkg/api
This commit is contained in:
		@@ -20,7 +20,8 @@ import (
 | 
				
			|||||||
	"reflect"
 | 
						"reflect"
 | 
				
			||||||
	"testing"
 | 
						"testing"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	"k8s.io/apimachinery/pkg/util/diff"
 | 
						"github.com/google/go-cmp/cmp"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	utilfeature "k8s.io/apiserver/pkg/util/feature"
 | 
						utilfeature "k8s.io/apiserver/pkg/util/feature"
 | 
				
			||||||
	featuregatetesting "k8s.io/component-base/featuregate/testing"
 | 
						featuregatetesting "k8s.io/component-base/featuregate/testing"
 | 
				
			||||||
	api "k8s.io/kubernetes/pkg/apis/core"
 | 
						api "k8s.io/kubernetes/pkg/apis/core"
 | 
				
			||||||
@@ -83,10 +84,10 @@ func TestDropDisabledFields(t *testing.T) {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
			DropDisabledFields(tc.newSpec, tc.oldSpec)
 | 
								DropDisabledFields(tc.newSpec, tc.oldSpec)
 | 
				
			||||||
			if !reflect.DeepEqual(tc.newSpec, tc.expectNewSpec) {
 | 
								if !reflect.DeepEqual(tc.newSpec, tc.expectNewSpec) {
 | 
				
			||||||
				t.Error(diff.ObjectReflectDiff(tc.newSpec, tc.expectNewSpec))
 | 
									t.Error(cmp.Diff(tc.newSpec, tc.expectNewSpec))
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			if !reflect.DeepEqual(tc.oldSpec, tc.expectOldSpec) {
 | 
								if !reflect.DeepEqual(tc.oldSpec, tc.expectOldSpec) {
 | 
				
			||||||
				t.Error(diff.ObjectReflectDiff(tc.oldSpec, tc.expectOldSpec))
 | 
									t.Error(cmp.Diff(tc.oldSpec, tc.expectOldSpec))
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		})
 | 
							})
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -21,7 +21,8 @@ import (
 | 
				
			|||||||
	"reflect"
 | 
						"reflect"
 | 
				
			||||||
	"testing"
 | 
						"testing"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	"k8s.io/apimachinery/pkg/util/diff"
 | 
						"github.com/google/go-cmp/cmp"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	utilfeature "k8s.io/apiserver/pkg/util/feature"
 | 
						utilfeature "k8s.io/apiserver/pkg/util/feature"
 | 
				
			||||||
	featuregatetesting "k8s.io/component-base/featuregate/testing"
 | 
						featuregatetesting "k8s.io/component-base/featuregate/testing"
 | 
				
			||||||
	"k8s.io/kubernetes/pkg/apis/core"
 | 
						"k8s.io/kubernetes/pkg/apis/core"
 | 
				
			||||||
@@ -87,12 +88,12 @@ func TestDropDisabledSnapshotDataSource(t *testing.T) {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
				// old pvc should never be changed
 | 
									// old pvc should never be changed
 | 
				
			||||||
				if !reflect.DeepEqual(oldpvc, oldpvcInfo.pvc()) {
 | 
									if !reflect.DeepEqual(oldpvc, oldpvcInfo.pvc()) {
 | 
				
			||||||
					t.Errorf("old pvc changed: %v", diff.ObjectReflectDiff(oldpvc, oldpvcInfo.pvc()))
 | 
										t.Errorf("old pvc changed: %v", cmp.Diff(oldpvc, oldpvcInfo.pvc()))
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
				// new pvc should not be changed
 | 
									// new pvc should not be changed
 | 
				
			||||||
				if !reflect.DeepEqual(newpvc, newpvcInfo.pvc()) {
 | 
									if !reflect.DeepEqual(newpvc, newpvcInfo.pvc()) {
 | 
				
			||||||
					t.Errorf("new pvc changed: %v", diff.ObjectReflectDiff(newpvc, newpvcInfo.pvc()))
 | 
										t.Errorf("new pvc changed: %v", cmp.Diff(newpvc, newpvcInfo.pvc()))
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
			})
 | 
								})
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -27,7 +27,6 @@ import (
 | 
				
			|||||||
	v1 "k8s.io/api/core/v1"
 | 
						v1 "k8s.io/api/core/v1"
 | 
				
			||||||
	"k8s.io/apimachinery/pkg/api/resource"
 | 
						"k8s.io/apimachinery/pkg/api/resource"
 | 
				
			||||||
	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
 | 
						metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
 | 
				
			||||||
	"k8s.io/apimachinery/pkg/util/diff"
 | 
					 | 
				
			||||||
	"k8s.io/apimachinery/pkg/util/sets"
 | 
						"k8s.io/apimachinery/pkg/util/sets"
 | 
				
			||||||
	"k8s.io/apimachinery/pkg/util/validation/field"
 | 
						"k8s.io/apimachinery/pkg/util/validation/field"
 | 
				
			||||||
	utilfeature "k8s.io/apiserver/pkg/util/feature"
 | 
						utilfeature "k8s.io/apiserver/pkg/util/feature"
 | 
				
			||||||
@@ -718,14 +717,14 @@ func TestDropSubPath(t *testing.T) {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
					// old pod should never be changed
 | 
										// old pod should never be changed
 | 
				
			||||||
					if !reflect.DeepEqual(oldPod, oldPodInfo.pod()) {
 | 
										if !reflect.DeepEqual(oldPod, oldPodInfo.pod()) {
 | 
				
			||||||
						t.Errorf("old pod changed: %v", diff.ObjectReflectDiff(oldPod, oldPodInfo.pod()))
 | 
											t.Errorf("old pod changed: %v", cmp.Diff(oldPod, oldPodInfo.pod()))
 | 
				
			||||||
					}
 | 
										}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
					switch {
 | 
										switch {
 | 
				
			||||||
					case enabled || oldPodHasSubpaths:
 | 
										case enabled || oldPodHasSubpaths:
 | 
				
			||||||
						// new pod should not be changed if the feature is enabled, or if the old pod had subpaths
 | 
											// new pod should not be changed if the feature is enabled, or if the old pod had subpaths
 | 
				
			||||||
						if !reflect.DeepEqual(newPod, newPodInfo.pod()) {
 | 
											if !reflect.DeepEqual(newPod, newPodInfo.pod()) {
 | 
				
			||||||
							t.Errorf("new pod changed: %v", diff.ObjectReflectDiff(newPod, newPodInfo.pod()))
 | 
												t.Errorf("new pod changed: %v", cmp.Diff(newPod, newPodInfo.pod()))
 | 
				
			||||||
						}
 | 
											}
 | 
				
			||||||
					case newPodHasSubpaths:
 | 
										case newPodHasSubpaths:
 | 
				
			||||||
						// new pod should be changed
 | 
											// new pod should be changed
 | 
				
			||||||
@@ -734,12 +733,12 @@ func TestDropSubPath(t *testing.T) {
 | 
				
			|||||||
						}
 | 
											}
 | 
				
			||||||
						// new pod should not have subpaths
 | 
											// new pod should not have subpaths
 | 
				
			||||||
						if !reflect.DeepEqual(newPod, podWithoutSubpaths()) {
 | 
											if !reflect.DeepEqual(newPod, podWithoutSubpaths()) {
 | 
				
			||||||
							t.Errorf("new pod had subpaths: %v", diff.ObjectReflectDiff(newPod, podWithoutSubpaths()))
 | 
												t.Errorf("new pod had subpaths: %v", cmp.Diff(newPod, podWithoutSubpaths()))
 | 
				
			||||||
						}
 | 
											}
 | 
				
			||||||
					default:
 | 
										default:
 | 
				
			||||||
						// new pod should not need to be changed
 | 
											// new pod should not need to be changed
 | 
				
			||||||
						if !reflect.DeepEqual(newPod, newPodInfo.pod()) {
 | 
											if !reflect.DeepEqual(newPod, newPodInfo.pod()) {
 | 
				
			||||||
							t.Errorf("new pod changed: %v", diff.ObjectReflectDiff(newPod, newPodInfo.pod()))
 | 
												t.Errorf("new pod changed: %v", cmp.Diff(newPod, newPodInfo.pod()))
 | 
				
			||||||
						}
 | 
											}
 | 
				
			||||||
					}
 | 
										}
 | 
				
			||||||
				})
 | 
									})
 | 
				
			||||||
@@ -826,14 +825,14 @@ func TestDropProcMount(t *testing.T) {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
					// old pod should never be changed
 | 
										// old pod should never be changed
 | 
				
			||||||
					if !reflect.DeepEqual(oldPod, oldPodInfo.pod()) {
 | 
										if !reflect.DeepEqual(oldPod, oldPodInfo.pod()) {
 | 
				
			||||||
						t.Errorf("old pod changed: %v", diff.ObjectReflectDiff(oldPod, oldPodInfo.pod()))
 | 
											t.Errorf("old pod changed: %v", cmp.Diff(oldPod, oldPodInfo.pod()))
 | 
				
			||||||
					}
 | 
										}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
					switch {
 | 
										switch {
 | 
				
			||||||
					case enabled || oldPodHasProcMount:
 | 
										case enabled || oldPodHasProcMount:
 | 
				
			||||||
						// new pod should not be changed if the feature is enabled, or if the old pod had ProcMount
 | 
											// new pod should not be changed if the feature is enabled, or if the old pod had ProcMount
 | 
				
			||||||
						if !reflect.DeepEqual(newPod, newPodInfo.pod()) {
 | 
											if !reflect.DeepEqual(newPod, newPodInfo.pod()) {
 | 
				
			||||||
							t.Errorf("new pod changed: %v", diff.ObjectReflectDiff(newPod, newPodInfo.pod()))
 | 
												t.Errorf("new pod changed: %v", cmp.Diff(newPod, newPodInfo.pod()))
 | 
				
			||||||
						}
 | 
											}
 | 
				
			||||||
					case newPodHasProcMount:
 | 
										case newPodHasProcMount:
 | 
				
			||||||
						// new pod should be changed
 | 
											// new pod should be changed
 | 
				
			||||||
@@ -847,7 +846,7 @@ func TestDropProcMount(t *testing.T) {
 | 
				
			|||||||
					default:
 | 
										default:
 | 
				
			||||||
						// new pod should not need to be changed
 | 
											// new pod should not need to be changed
 | 
				
			||||||
						if !reflect.DeepEqual(newPod, newPodInfo.pod()) {
 | 
											if !reflect.DeepEqual(newPod, newPodInfo.pod()) {
 | 
				
			||||||
							t.Errorf("new pod changed: %v", diff.ObjectReflectDiff(newPod, newPodInfo.pod()))
 | 
												t.Errorf("new pod changed: %v", cmp.Diff(newPod, newPodInfo.pod()))
 | 
				
			||||||
						}
 | 
											}
 | 
				
			||||||
					}
 | 
										}
 | 
				
			||||||
				})
 | 
									})
 | 
				
			||||||
@@ -936,14 +935,14 @@ func TestDropEmptyDirSizeLimit(t *testing.T) {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
					// old pod should never be changed
 | 
										// old pod should never be changed
 | 
				
			||||||
					if !reflect.DeepEqual(oldPod, oldPodInfo.pod()) {
 | 
										if !reflect.DeepEqual(oldPod, oldPodInfo.pod()) {
 | 
				
			||||||
						t.Errorf("old pod changed: %v", diff.ObjectReflectDiff(oldPod, oldPodInfo.pod()))
 | 
											t.Errorf("old pod changed: %v", cmp.Diff(oldPod, oldPodInfo.pod()))
 | 
				
			||||||
					}
 | 
										}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
					switch {
 | 
										switch {
 | 
				
			||||||
					case enabled || oldPodHasEmptyDirSizeLimit:
 | 
										case enabled || oldPodHasEmptyDirSizeLimit:
 | 
				
			||||||
						// new pod should not be changed if the feature is enabled, or if the old pod had EmptyDir SizeLimit
 | 
											// new pod should not be changed if the feature is enabled, or if the old pod had EmptyDir SizeLimit
 | 
				
			||||||
						if !reflect.DeepEqual(newPod, newPodInfo.pod()) {
 | 
											if !reflect.DeepEqual(newPod, newPodInfo.pod()) {
 | 
				
			||||||
							t.Errorf("new pod changed: %v", diff.ObjectReflectDiff(newPod, newPodInfo.pod()))
 | 
												t.Errorf("new pod changed: %v", cmp.Diff(newPod, newPodInfo.pod()))
 | 
				
			||||||
						}
 | 
											}
 | 
				
			||||||
					case newPodHasEmptyDirSizeLimit:
 | 
										case newPodHasEmptyDirSizeLimit:
 | 
				
			||||||
						// new pod should be changed
 | 
											// new pod should be changed
 | 
				
			||||||
@@ -952,12 +951,12 @@ func TestDropEmptyDirSizeLimit(t *testing.T) {
 | 
				
			|||||||
						}
 | 
											}
 | 
				
			||||||
						// new pod should not have EmptyDir SizeLimit
 | 
											// new pod should not have EmptyDir SizeLimit
 | 
				
			||||||
						if !reflect.DeepEqual(newPod, podWithoutEmptyDirSizeLimit()) {
 | 
											if !reflect.DeepEqual(newPod, podWithoutEmptyDirSizeLimit()) {
 | 
				
			||||||
							t.Errorf("new pod had EmptyDir SizeLimit: %v", diff.ObjectReflectDiff(newPod, podWithoutEmptyDirSizeLimit()))
 | 
												t.Errorf("new pod had EmptyDir SizeLimit: %v", cmp.Diff(newPod, podWithoutEmptyDirSizeLimit()))
 | 
				
			||||||
						}
 | 
											}
 | 
				
			||||||
					default:
 | 
										default:
 | 
				
			||||||
						// new pod should not need to be changed
 | 
											// new pod should not need to be changed
 | 
				
			||||||
						if !reflect.DeepEqual(newPod, newPodInfo.pod()) {
 | 
											if !reflect.DeepEqual(newPod, newPodInfo.pod()) {
 | 
				
			||||||
							t.Errorf("new pod changed: %v", diff.ObjectReflectDiff(newPod, newPodInfo.pod()))
 | 
												t.Errorf("new pod changed: %v", cmp.Diff(newPod, newPodInfo.pod()))
 | 
				
			||||||
						}
 | 
											}
 | 
				
			||||||
					}
 | 
										}
 | 
				
			||||||
				})
 | 
									})
 | 
				
			||||||
@@ -1018,14 +1017,14 @@ func TestDropAppArmor(t *testing.T) {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
					// old pod should never be changed
 | 
										// old pod should never be changed
 | 
				
			||||||
					if !reflect.DeepEqual(oldPod, oldPodInfo.pod()) {
 | 
										if !reflect.DeepEqual(oldPod, oldPodInfo.pod()) {
 | 
				
			||||||
						t.Errorf("old pod changed: %v", diff.ObjectReflectDiff(oldPod, oldPodInfo.pod()))
 | 
											t.Errorf("old pod changed: %v", cmp.Diff(oldPod, oldPodInfo.pod()))
 | 
				
			||||||
					}
 | 
										}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
					switch {
 | 
										switch {
 | 
				
			||||||
					case enabled || oldPodHasAppArmor:
 | 
										case enabled || oldPodHasAppArmor:
 | 
				
			||||||
						// new pod should not be changed if the feature is enabled, or if the old pod had AppArmor
 | 
											// new pod should not be changed if the feature is enabled, or if the old pod had AppArmor
 | 
				
			||||||
						if !reflect.DeepEqual(newPod, newPodInfo.pod()) {
 | 
											if !reflect.DeepEqual(newPod, newPodInfo.pod()) {
 | 
				
			||||||
							t.Errorf("new pod changed: %v", diff.ObjectReflectDiff(newPod, newPodInfo.pod()))
 | 
												t.Errorf("new pod changed: %v", cmp.Diff(newPod, newPodInfo.pod()))
 | 
				
			||||||
						}
 | 
											}
 | 
				
			||||||
					case newPodHasAppArmor:
 | 
										case newPodHasAppArmor:
 | 
				
			||||||
						// new pod should be changed
 | 
											// new pod should be changed
 | 
				
			||||||
@@ -1034,12 +1033,12 @@ func TestDropAppArmor(t *testing.T) {
 | 
				
			|||||||
						}
 | 
											}
 | 
				
			||||||
						// new pod should not have AppArmor
 | 
											// new pod should not have AppArmor
 | 
				
			||||||
						if !reflect.DeepEqual(newPod, podWithoutAppArmor()) {
 | 
											if !reflect.DeepEqual(newPod, podWithoutAppArmor()) {
 | 
				
			||||||
							t.Errorf("new pod had EmptyDir SizeLimit: %v", diff.ObjectReflectDiff(newPod, podWithoutAppArmor()))
 | 
												t.Errorf("new pod had EmptyDir SizeLimit: %v", cmp.Diff(newPod, podWithoutAppArmor()))
 | 
				
			||||||
						}
 | 
											}
 | 
				
			||||||
					default:
 | 
										default:
 | 
				
			||||||
						// new pod should not need to be changed
 | 
											// new pod should not need to be changed
 | 
				
			||||||
						if !reflect.DeepEqual(newPod, newPodInfo.pod()) {
 | 
											if !reflect.DeepEqual(newPod, newPodInfo.pod()) {
 | 
				
			||||||
							t.Errorf("new pod changed: %v", diff.ObjectReflectDiff(newPod, newPodInfo.pod()))
 | 
												t.Errorf("new pod changed: %v", cmp.Diff(newPod, newPodInfo.pod()))
 | 
				
			||||||
						}
 | 
											}
 | 
				
			||||||
					}
 | 
										}
 | 
				
			||||||
				})
 | 
									})
 | 
				
			||||||
@@ -1111,14 +1110,14 @@ func TestDropSubPathExpr(t *testing.T) {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
				// old pod should never be changed
 | 
									// old pod should never be changed
 | 
				
			||||||
				if !reflect.DeepEqual(oldPod, oldPodInfo.pod()) {
 | 
									if !reflect.DeepEqual(oldPod, oldPodInfo.pod()) {
 | 
				
			||||||
					t.Errorf("old pod changed: %v", diff.ObjectReflectDiff(oldPod, oldPodInfo.pod()))
 | 
										t.Errorf("old pod changed: %v", cmp.Diff(oldPod, oldPodInfo.pod()))
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
				switch {
 | 
									switch {
 | 
				
			||||||
				case enabled || oldPodHasSubpaths:
 | 
									case enabled || oldPodHasSubpaths:
 | 
				
			||||||
					// new pod should not be changed if the feature is enabled, or if the old pod had subpaths
 | 
										// new pod should not be changed if the feature is enabled, or if the old pod had subpaths
 | 
				
			||||||
					if !reflect.DeepEqual(newPod, newPodInfo.pod()) {
 | 
										if !reflect.DeepEqual(newPod, newPodInfo.pod()) {
 | 
				
			||||||
						t.Errorf("new pod changed: %v", diff.ObjectReflectDiff(newPod, newPodInfo.pod()))
 | 
											t.Errorf("new pod changed: %v", cmp.Diff(newPod, newPodInfo.pod()))
 | 
				
			||||||
					}
 | 
										}
 | 
				
			||||||
				case newPodHasSubpaths:
 | 
									case newPodHasSubpaths:
 | 
				
			||||||
					// new pod should be changed
 | 
										// new pod should be changed
 | 
				
			||||||
@@ -1127,12 +1126,12 @@ func TestDropSubPathExpr(t *testing.T) {
 | 
				
			|||||||
					}
 | 
										}
 | 
				
			||||||
					// new pod should not have subpaths
 | 
										// new pod should not have subpaths
 | 
				
			||||||
					if !reflect.DeepEqual(newPod, podWithoutSubpaths()) {
 | 
										if !reflect.DeepEqual(newPod, podWithoutSubpaths()) {
 | 
				
			||||||
						t.Errorf("new pod had subpaths: %v", diff.ObjectReflectDiff(newPod, podWithoutSubpaths()))
 | 
											t.Errorf("new pod had subpaths: %v", cmp.Diff(newPod, podWithoutSubpaths()))
 | 
				
			||||||
					}
 | 
										}
 | 
				
			||||||
				default:
 | 
									default:
 | 
				
			||||||
					// new pod should not need to be changed
 | 
										// new pod should not need to be changed
 | 
				
			||||||
					if !reflect.DeepEqual(newPod, newPodInfo.pod()) {
 | 
										if !reflect.DeepEqual(newPod, newPodInfo.pod()) {
 | 
				
			||||||
						t.Errorf("new pod changed: %v", diff.ObjectReflectDiff(newPod, newPodInfo.pod()))
 | 
											t.Errorf("new pod changed: %v", cmp.Diff(newPod, newPodInfo.pod()))
 | 
				
			||||||
					}
 | 
										}
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
			})
 | 
								})
 | 
				
			||||||
@@ -1208,14 +1207,14 @@ func TestDropProbeGracePeriod(t *testing.T) {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
				// old pod should never be changed
 | 
									// old pod should never be changed
 | 
				
			||||||
				if !reflect.DeepEqual(oldPod, oldPodInfo.pod()) {
 | 
									if !reflect.DeepEqual(oldPod, oldPodInfo.pod()) {
 | 
				
			||||||
					t.Errorf("old pod changed: %v", diff.ObjectReflectDiff(oldPod, oldPodInfo.pod()))
 | 
										t.Errorf("old pod changed: %v", cmp.Diff(oldPod, oldPodInfo.pod()))
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
				switch {
 | 
									switch {
 | 
				
			||||||
				case enabled || oldPodHasGracePeriod:
 | 
									case enabled || oldPodHasGracePeriod:
 | 
				
			||||||
					// new pod should not be changed if the feature is enabled, or if the old pod had subpaths
 | 
										// new pod should not be changed if the feature is enabled, or if the old pod had subpaths
 | 
				
			||||||
					if !reflect.DeepEqual(newPod, newPodInfo.pod()) {
 | 
										if !reflect.DeepEqual(newPod, newPodInfo.pod()) {
 | 
				
			||||||
						t.Errorf("new pod changed: %v", diff.ObjectReflectDiff(newPod, newPodInfo.pod()))
 | 
											t.Errorf("new pod changed: %v", cmp.Diff(newPod, newPodInfo.pod()))
 | 
				
			||||||
					}
 | 
										}
 | 
				
			||||||
				case newPodHasGracePeriod:
 | 
									case newPodHasGracePeriod:
 | 
				
			||||||
					// new pod should be changed
 | 
										// new pod should be changed
 | 
				
			||||||
@@ -1224,12 +1223,12 @@ func TestDropProbeGracePeriod(t *testing.T) {
 | 
				
			|||||||
					}
 | 
										}
 | 
				
			||||||
					// new pod should not have subpaths
 | 
										// new pod should not have subpaths
 | 
				
			||||||
					if !reflect.DeepEqual(newPod, podWithoutProbeGracePeriod()) {
 | 
										if !reflect.DeepEqual(newPod, podWithoutProbeGracePeriod()) {
 | 
				
			||||||
						t.Errorf("new pod had probe-level terminationGracePeriod: %v", diff.ObjectReflectDiff(newPod, podWithoutProbeGracePeriod()))
 | 
											t.Errorf("new pod had probe-level terminationGracePeriod: %v", cmp.Diff(newPod, podWithoutProbeGracePeriod()))
 | 
				
			||||||
					}
 | 
										}
 | 
				
			||||||
				default:
 | 
									default:
 | 
				
			||||||
					// new pod should not need to be changed
 | 
										// new pod should not need to be changed
 | 
				
			||||||
					if !reflect.DeepEqual(newPod, newPodInfo.pod()) {
 | 
										if !reflect.DeepEqual(newPod, newPodInfo.pod()) {
 | 
				
			||||||
						t.Errorf("new pod changed: %v", diff.ObjectReflectDiff(newPod, newPodInfo.pod()))
 | 
											t.Errorf("new pod changed: %v", cmp.Diff(newPod, newPodInfo.pod()))
 | 
				
			||||||
					}
 | 
										}
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
			})
 | 
								})
 | 
				
			||||||
@@ -1328,11 +1327,11 @@ func TestDropStatusPodIPs(t *testing.T) {
 | 
				
			|||||||
			old := tc.oldPodStatus.DeepCopy()
 | 
								old := tc.oldPodStatus.DeepCopy()
 | 
				
			||||||
			// old pod status should never be changed
 | 
								// old pod status should never be changed
 | 
				
			||||||
			if !reflect.DeepEqual(tc.oldPodStatus, old) {
 | 
								if !reflect.DeepEqual(tc.oldPodStatus, old) {
 | 
				
			||||||
				t.Errorf("%v: old pod status changed: %v", tc.name, diff.ObjectReflectDiff(tc.oldPodStatus, old))
 | 
									t.Errorf("%v: old pod status changed: %v", tc.name, cmp.Diff(tc.oldPodStatus, old))
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			if !reflect.DeepEqual(tc.podStatus, tc.comparePodStatus) {
 | 
								if !reflect.DeepEqual(tc.podStatus, tc.comparePodStatus) {
 | 
				
			||||||
				t.Errorf("%v: unexpected pod status: %v", tc.name, diff.ObjectReflectDiff(tc.podStatus, tc.comparePodStatus))
 | 
									t.Errorf("%v: unexpected pod status: %v", tc.name, cmp.Diff(tc.podStatus, tc.comparePodStatus))
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		}()
 | 
							}()
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
@@ -1397,14 +1396,14 @@ func TestDropEphemeralContainers(t *testing.T) {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
					// old pod should never be changed
 | 
										// old pod should never be changed
 | 
				
			||||||
					if !reflect.DeepEqual(oldPod, oldPodInfo.pod()) {
 | 
										if !reflect.DeepEqual(oldPod, oldPodInfo.pod()) {
 | 
				
			||||||
						t.Errorf("old pod changed: %v", diff.ObjectReflectDiff(oldPod, oldPodInfo.pod()))
 | 
											t.Errorf("old pod changed: %v", cmp.Diff(oldPod, oldPodInfo.pod()))
 | 
				
			||||||
					}
 | 
										}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
					switch {
 | 
										switch {
 | 
				
			||||||
					case enabled || oldPodHasEphemeralContainers:
 | 
										case enabled || oldPodHasEphemeralContainers:
 | 
				
			||||||
						// new pod should not be changed if the feature is enabled, or if the old pod had subpaths
 | 
											// new pod should not be changed if the feature is enabled, or if the old pod had subpaths
 | 
				
			||||||
						if !reflect.DeepEqual(newPod, newPodInfo.pod()) {
 | 
											if !reflect.DeepEqual(newPod, newPodInfo.pod()) {
 | 
				
			||||||
							t.Errorf("new pod changed: %v", diff.ObjectReflectDiff(newPod, newPodInfo.pod()))
 | 
												t.Errorf("new pod changed: %v", cmp.Diff(newPod, newPodInfo.pod()))
 | 
				
			||||||
						}
 | 
											}
 | 
				
			||||||
					case newPodHasEphemeralContainers:
 | 
										case newPodHasEphemeralContainers:
 | 
				
			||||||
						// new pod should be changed
 | 
											// new pod should be changed
 | 
				
			||||||
@@ -1413,12 +1412,12 @@ func TestDropEphemeralContainers(t *testing.T) {
 | 
				
			|||||||
						}
 | 
											}
 | 
				
			||||||
						// new pod should not have subpaths
 | 
											// new pod should not have subpaths
 | 
				
			||||||
						if !reflect.DeepEqual(newPod, podWithoutEphemeralContainers()) {
 | 
											if !reflect.DeepEqual(newPod, podWithoutEphemeralContainers()) {
 | 
				
			||||||
							t.Errorf("new pod had subpaths: %v", diff.ObjectReflectDiff(newPod, podWithoutEphemeralContainers()))
 | 
												t.Errorf("new pod had subpaths: %v", cmp.Diff(newPod, podWithoutEphemeralContainers()))
 | 
				
			||||||
						}
 | 
											}
 | 
				
			||||||
					default:
 | 
										default:
 | 
				
			||||||
						// new pod should not need to be changed
 | 
											// new pod should not need to be changed
 | 
				
			||||||
						if !reflect.DeepEqual(newPod, newPodInfo.pod()) {
 | 
											if !reflect.DeepEqual(newPod, newPodInfo.pod()) {
 | 
				
			||||||
							t.Errorf("new pod changed: %v", diff.ObjectReflectDiff(newPod, newPodInfo.pod()))
 | 
												t.Errorf("new pod changed: %v", cmp.Diff(newPod, newPodInfo.pod()))
 | 
				
			||||||
						}
 | 
											}
 | 
				
			||||||
					}
 | 
										}
 | 
				
			||||||
				})
 | 
									})
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -21,7 +21,8 @@ import (
 | 
				
			|||||||
	"reflect"
 | 
						"reflect"
 | 
				
			||||||
	"testing"
 | 
						"testing"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	"k8s.io/apimachinery/pkg/util/diff"
 | 
						"github.com/google/go-cmp/cmp"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	utilfeature "k8s.io/apiserver/pkg/util/feature"
 | 
						utilfeature "k8s.io/apiserver/pkg/util/feature"
 | 
				
			||||||
	featuregatetesting "k8s.io/component-base/featuregate/testing"
 | 
						featuregatetesting "k8s.io/component-base/featuregate/testing"
 | 
				
			||||||
	api "k8s.io/kubernetes/pkg/apis/core"
 | 
						api "k8s.io/kubernetes/pkg/apis/core"
 | 
				
			||||||
@@ -78,14 +79,14 @@ func TestDropAllowedProcMountTypes(t *testing.T) {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
					// old PodSecurityPolicySpec should never be changed
 | 
										// old PodSecurityPolicySpec should never be changed
 | 
				
			||||||
					if !reflect.DeepEqual(oldPSPSpec, oldPSPSpecInfo.sc()) {
 | 
										if !reflect.DeepEqual(oldPSPSpec, oldPSPSpecInfo.sc()) {
 | 
				
			||||||
						t.Errorf("old PodSecurityPolicySpec changed: %v", diff.ObjectReflectDiff(oldPSPSpec, oldPSPSpecInfo.sc()))
 | 
											t.Errorf("old PodSecurityPolicySpec changed: %v", cmp.Diff(oldPSPSpec, oldPSPSpecInfo.sc()))
 | 
				
			||||||
					}
 | 
										}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
					switch {
 | 
										switch {
 | 
				
			||||||
					case enabled || oldPSPSpecHasAllowedProcMountTypes:
 | 
										case enabled || oldPSPSpecHasAllowedProcMountTypes:
 | 
				
			||||||
						// new PodSecurityPolicySpec should not be changed if the feature is enabled, or if the old PodSecurityPolicySpec had AllowedProcMountTypes
 | 
											// new PodSecurityPolicySpec should not be changed if the feature is enabled, or if the old PodSecurityPolicySpec had AllowedProcMountTypes
 | 
				
			||||||
						if !reflect.DeepEqual(newPSPSpec, newPSPSpecInfo.sc()) {
 | 
											if !reflect.DeepEqual(newPSPSpec, newPSPSpecInfo.sc()) {
 | 
				
			||||||
							t.Errorf("new PodSecurityPolicySpec changed: %v", diff.ObjectReflectDiff(newPSPSpec, newPSPSpecInfo.sc()))
 | 
												t.Errorf("new PodSecurityPolicySpec changed: %v", cmp.Diff(newPSPSpec, newPSPSpecInfo.sc()))
 | 
				
			||||||
						}
 | 
											}
 | 
				
			||||||
					case newPSPSpecHasAllowedProcMountTypes:
 | 
										case newPSPSpecHasAllowedProcMountTypes:
 | 
				
			||||||
						// new PodSecurityPolicySpec should be changed
 | 
											// new PodSecurityPolicySpec should be changed
 | 
				
			||||||
@@ -94,12 +95,12 @@ func TestDropAllowedProcMountTypes(t *testing.T) {
 | 
				
			|||||||
						}
 | 
											}
 | 
				
			||||||
						// new PodSecurityPolicySpec should not have AllowedProcMountTypes
 | 
											// new PodSecurityPolicySpec should not have AllowedProcMountTypes
 | 
				
			||||||
						if !reflect.DeepEqual(newPSPSpec, scWithoutAllowedProcMountTypes()) {
 | 
											if !reflect.DeepEqual(newPSPSpec, scWithoutAllowedProcMountTypes()) {
 | 
				
			||||||
							t.Errorf("new PodSecurityPolicySpec had PodSecurityPolicySpecAllowedProcMountTypes: %v", diff.ObjectReflectDiff(newPSPSpec, scWithoutAllowedProcMountTypes()))
 | 
												t.Errorf("new PodSecurityPolicySpec had PodSecurityPolicySpecAllowedProcMountTypes: %v", cmp.Diff(newPSPSpec, scWithoutAllowedProcMountTypes()))
 | 
				
			||||||
						}
 | 
											}
 | 
				
			||||||
					default:
 | 
										default:
 | 
				
			||||||
						// new PodSecurityPolicySpec should not need to be changed
 | 
											// new PodSecurityPolicySpec should not need to be changed
 | 
				
			||||||
						if !reflect.DeepEqual(newPSPSpec, newPSPSpecInfo.sc()) {
 | 
											if !reflect.DeepEqual(newPSPSpec, newPSPSpecInfo.sc()) {
 | 
				
			||||||
							t.Errorf("new PodSecurityPolicySpec changed: %v", diff.ObjectReflectDiff(newPSPSpec, newPSPSpecInfo.sc()))
 | 
												t.Errorf("new PodSecurityPolicySpec changed: %v", cmp.Diff(newPSPSpec, newPSPSpecInfo.sc()))
 | 
				
			||||||
						}
 | 
											}
 | 
				
			||||||
					}
 | 
										}
 | 
				
			||||||
				})
 | 
									})
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -21,12 +21,13 @@ import (
 | 
				
			|||||||
	"math/rand"
 | 
						"math/rand"
 | 
				
			||||||
	"testing"
 | 
						"testing"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						"github.com/google/go-cmp/cmp"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	v1 "k8s.io/api/core/v1"
 | 
						v1 "k8s.io/api/core/v1"
 | 
				
			||||||
	"k8s.io/apimachinery/pkg/api/apitesting/fuzzer"
 | 
						"k8s.io/apimachinery/pkg/api/apitesting/fuzzer"
 | 
				
			||||||
	apiequality "k8s.io/apimachinery/pkg/api/equality"
 | 
						apiequality "k8s.io/apimachinery/pkg/api/equality"
 | 
				
			||||||
	"k8s.io/apimachinery/pkg/runtime"
 | 
						"k8s.io/apimachinery/pkg/runtime"
 | 
				
			||||||
	"k8s.io/apimachinery/pkg/runtime/schema"
 | 
						"k8s.io/apimachinery/pkg/runtime/schema"
 | 
				
			||||||
	"k8s.io/apimachinery/pkg/util/diff"
 | 
					 | 
				
			||||||
	"k8s.io/kubernetes/pkg/api/legacyscheme"
 | 
						"k8s.io/kubernetes/pkg/api/legacyscheme"
 | 
				
			||||||
	api "k8s.io/kubernetes/pkg/apis/core"
 | 
						api "k8s.io/kubernetes/pkg/apis/core"
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
@@ -83,7 +84,7 @@ func BenchmarkNodeConversion(b *testing.B) {
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
	b.StopTimer()
 | 
						b.StopTimer()
 | 
				
			||||||
	if !apiequality.Semantic.DeepDerivative(node, *result) {
 | 
						if !apiequality.Semantic.DeepDerivative(node, *result) {
 | 
				
			||||||
		b.Fatalf("Incorrect conversion: %s", diff.ObjectDiff(node, *result))
 | 
							b.Fatalf("Incorrect conversion: %s", cmp.Diff(node, *result))
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -22,6 +22,7 @@ import (
 | 
				
			|||||||
	"reflect"
 | 
						"reflect"
 | 
				
			||||||
	"testing"
 | 
						"testing"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						"github.com/google/go-cmp/cmp"
 | 
				
			||||||
	"github.com/google/gofuzz"
 | 
						"github.com/google/gofuzz"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	"k8s.io/apimachinery/pkg/api/apitesting/fuzzer"
 | 
						"k8s.io/apimachinery/pkg/api/apitesting/fuzzer"
 | 
				
			||||||
@@ -51,7 +52,7 @@ func doDeepCopyTest(t *testing.T, kind schema.GroupVersionKind, f *fuzz.Fuzzer)
 | 
				
			|||||||
	f.Fuzz(item)
 | 
						f.Fuzz(item)
 | 
				
			||||||
	itemCopy := item.DeepCopyObject()
 | 
						itemCopy := item.DeepCopyObject()
 | 
				
			||||||
	if !reflect.DeepEqual(item, itemCopy) {
 | 
						if !reflect.DeepEqual(item, itemCopy) {
 | 
				
			||||||
		t.Errorf("\nexpected: %#v\n\ngot:      %#v\n\ndiff:      %v", item, itemCopy, diff.ObjectReflectDiff(item, itemCopy))
 | 
							t.Errorf("\nexpected: %#v\n\ngot:      %#v\n\ndiff:      %v", item, itemCopy, cmp.Diff(item, itemCopy))
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	prefuzzData := &bytes.Buffer{}
 | 
						prefuzzData := &bytes.Buffer{}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -22,6 +22,7 @@ import (
 | 
				
			|||||||
	"sort"
 | 
						"sort"
 | 
				
			||||||
	"testing"
 | 
						"testing"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						"github.com/google/go-cmp/cmp"
 | 
				
			||||||
	fuzz "github.com/google/gofuzz"
 | 
						fuzz "github.com/google/gofuzz"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	apiv1 "k8s.io/api/core/v1"
 | 
						apiv1 "k8s.io/api/core/v1"
 | 
				
			||||||
@@ -30,7 +31,6 @@ import (
 | 
				
			|||||||
	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
 | 
						metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
 | 
				
			||||||
	"k8s.io/apimachinery/pkg/runtime"
 | 
						"k8s.io/apimachinery/pkg/runtime"
 | 
				
			||||||
	"k8s.io/apimachinery/pkg/runtime/schema"
 | 
						"k8s.io/apimachinery/pkg/runtime/schema"
 | 
				
			||||||
	"k8s.io/apimachinery/pkg/util/diff"
 | 
					 | 
				
			||||||
	"k8s.io/kubernetes/pkg/api/legacyscheme"
 | 
						"k8s.io/kubernetes/pkg/api/legacyscheme"
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -235,7 +235,7 @@ func TestDefaulting(t *testing.T) {
 | 
				
			|||||||
			if !reflect.DeepEqual(original, withDefaults) {
 | 
								if !reflect.DeepEqual(original, withDefaults) {
 | 
				
			||||||
				changedOnce = true
 | 
									changedOnce = true
 | 
				
			||||||
				if !expectedChanged {
 | 
									if !expectedChanged {
 | 
				
			||||||
					t.Errorf("{Group: \"%s\", Version: \"%s\", Kind: \"%s\"} did not expect defaults to be set - update expected or check defaulter registering: %s", gvk.Group, gvk.Version, gvk.Kind, diff.ObjectReflectDiff(original, withDefaults))
 | 
										t.Errorf("{Group: \"%s\", Version: \"%s\", Kind: \"%s\"} did not expect defaults to be set - update expected or check defaulter registering: %s", gvk.Group, gvk.Version, gvk.Kind, cmp.Diff(original, withDefaults))
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -25,6 +25,8 @@ import (
 | 
				
			|||||||
	"testing"
 | 
						"testing"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	"github.com/gogo/protobuf/proto"
 | 
						"github.com/gogo/protobuf/proto"
 | 
				
			||||||
 | 
						"github.com/google/go-cmp/cmp"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	v1 "k8s.io/api/core/v1"
 | 
						v1 "k8s.io/api/core/v1"
 | 
				
			||||||
	"k8s.io/apimachinery/pkg/api/apitesting/fuzzer"
 | 
						"k8s.io/apimachinery/pkg/api/apitesting/fuzzer"
 | 
				
			||||||
	apiequality "k8s.io/apimachinery/pkg/api/equality"
 | 
						apiequality "k8s.io/apimachinery/pkg/api/equality"
 | 
				
			||||||
@@ -32,7 +34,6 @@ import (
 | 
				
			|||||||
	"k8s.io/apimachinery/pkg/runtime"
 | 
						"k8s.io/apimachinery/pkg/runtime"
 | 
				
			||||||
	"k8s.io/apimachinery/pkg/runtime/schema"
 | 
						"k8s.io/apimachinery/pkg/runtime/schema"
 | 
				
			||||||
	"k8s.io/apimachinery/pkg/runtime/serializer/protobuf"
 | 
						"k8s.io/apimachinery/pkg/runtime/serializer/protobuf"
 | 
				
			||||||
	"k8s.io/apimachinery/pkg/util/diff"
 | 
					 | 
				
			||||||
	"k8s.io/kubernetes/pkg/api/legacyscheme"
 | 
						"k8s.io/kubernetes/pkg/api/legacyscheme"
 | 
				
			||||||
	api "k8s.io/kubernetes/pkg/apis/core"
 | 
						api "k8s.io/kubernetes/pkg/apis/core"
 | 
				
			||||||
	_ "k8s.io/kubernetes/pkg/apis/extensions"
 | 
						_ "k8s.io/kubernetes/pkg/apis/extensions"
 | 
				
			||||||
@@ -112,7 +113,7 @@ func TestProtobufRoundTrip(t *testing.T) {
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
	if !apiequality.Semantic.Equalities.DeepEqual(out, obj) {
 | 
						if !apiequality.Semantic.Equalities.DeepEqual(out, obj) {
 | 
				
			||||||
		t.Logf("marshal\n%s", hex.Dump(data))
 | 
							t.Logf("marshal\n%s", hex.Dump(data))
 | 
				
			||||||
		t.Fatalf("Unmarshal is unequal\n%s", diff.ObjectGoPrintDiff(out, obj))
 | 
							t.Fatalf("Unmarshal is unequal\n%s", cmp.Diff(out, obj))
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -25,7 +25,9 @@ import (
 | 
				
			|||||||
	"reflect"
 | 
						"reflect"
 | 
				
			||||||
	"testing"
 | 
						"testing"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						"github.com/google/go-cmp/cmp"
 | 
				
			||||||
	jsoniter "github.com/json-iterator/go"
 | 
						jsoniter "github.com/json-iterator/go"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	appsv1 "k8s.io/api/apps/v1"
 | 
						appsv1 "k8s.io/api/apps/v1"
 | 
				
			||||||
	v1 "k8s.io/api/core/v1"
 | 
						v1 "k8s.io/api/core/v1"
 | 
				
			||||||
	"k8s.io/apimachinery/pkg/api/apitesting/fuzzer"
 | 
						"k8s.io/apimachinery/pkg/api/apitesting/fuzzer"
 | 
				
			||||||
@@ -38,7 +40,6 @@ import (
 | 
				
			|||||||
	"k8s.io/apimachinery/pkg/runtime/schema"
 | 
						"k8s.io/apimachinery/pkg/runtime/schema"
 | 
				
			||||||
	"k8s.io/apimachinery/pkg/runtime/serializer/json"
 | 
						"k8s.io/apimachinery/pkg/runtime/serializer/json"
 | 
				
			||||||
	"k8s.io/apimachinery/pkg/runtime/serializer/streaming"
 | 
						"k8s.io/apimachinery/pkg/runtime/serializer/streaming"
 | 
				
			||||||
	"k8s.io/apimachinery/pkg/util/diff"
 | 
					 | 
				
			||||||
	"k8s.io/apimachinery/pkg/util/sets"
 | 
						"k8s.io/apimachinery/pkg/util/sets"
 | 
				
			||||||
	"k8s.io/apimachinery/pkg/watch"
 | 
						"k8s.io/apimachinery/pkg/watch"
 | 
				
			||||||
	"k8s.io/kubernetes/pkg/api/legacyscheme"
 | 
						"k8s.io/kubernetes/pkg/api/legacyscheme"
 | 
				
			||||||
@@ -254,7 +255,7 @@ func TestEncodePtr(t *testing.T) {
 | 
				
			|||||||
		t.Fatalf("Got wrong type")
 | 
							t.Fatalf("Got wrong type")
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	if !apiequality.Semantic.DeepEqual(obj2, pod) {
 | 
						if !apiequality.Semantic.DeepEqual(obj2, pod) {
 | 
				
			||||||
		t.Errorf("\nExpected:\n\n %#v,\n\nGot:\n\n %#vDiff: %v\n\n", pod, obj2, diff.ObjectDiff(obj2, pod))
 | 
							t.Errorf("\nExpected:\n\n %#v,\n\nGot:\n\n %#vDiff: %v\n\n", pod, obj2, cmp.Diff(obj2, pod))
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -373,7 +374,7 @@ func TestObjectWatchFraming(t *testing.T) {
 | 
				
			|||||||
		resultSecret.Kind = "Secret"
 | 
							resultSecret.Kind = "Secret"
 | 
				
			||||||
		resultSecret.APIVersion = "v1"
 | 
							resultSecret.APIVersion = "v1"
 | 
				
			||||||
		if !apiequality.Semantic.DeepEqual(v1secret, res) {
 | 
							if !apiequality.Semantic.DeepEqual(v1secret, res) {
 | 
				
			||||||
			t.Fatalf("objects did not match: %s", diff.ObjectGoPrintDiff(v1secret, res))
 | 
								t.Fatalf("objects did not match: %s", cmp.Diff(v1secret, res))
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		// write a watch event through the frame writer and read it back in
 | 
							// write a watch event through the frame writer and read it back in
 | 
				
			||||||
@@ -407,7 +408,7 @@ func TestObjectWatchFraming(t *testing.T) {
 | 
				
			|||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if !apiequality.Semantic.DeepEqual(secret, outEvent.Object.Object) {
 | 
							if !apiequality.Semantic.DeepEqual(secret, outEvent.Object.Object) {
 | 
				
			||||||
			t.Fatalf("%s: did not match after frame decoding: %s", info.MediaType, diff.ObjectGoPrintDiff(secret, outEvent.Object.Object))
 | 
								t.Fatalf("%s: did not match after frame decoding: %s", info.MediaType, cmp.Diff(secret, outEvent.Object.Object))
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -22,6 +22,7 @@ import (
 | 
				
			|||||||
	"sort"
 | 
						"sort"
 | 
				
			||||||
	"testing"
 | 
						"testing"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						"github.com/google/go-cmp/cmp"
 | 
				
			||||||
	fuzz "github.com/google/gofuzz"
 | 
						fuzz "github.com/google/gofuzz"
 | 
				
			||||||
	jsoniter "github.com/json-iterator/go"
 | 
						jsoniter "github.com/json-iterator/go"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -33,7 +34,6 @@ import (
 | 
				
			|||||||
	metaunstruct "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
 | 
						metaunstruct "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
 | 
				
			||||||
	"k8s.io/apimachinery/pkg/runtime"
 | 
						"k8s.io/apimachinery/pkg/runtime"
 | 
				
			||||||
	"k8s.io/apimachinery/pkg/runtime/schema"
 | 
						"k8s.io/apimachinery/pkg/runtime/schema"
 | 
				
			||||||
	"k8s.io/apimachinery/pkg/util/diff"
 | 
					 | 
				
			||||||
	"k8s.io/apimachinery/pkg/util/json"
 | 
						"k8s.io/apimachinery/pkg/util/json"
 | 
				
			||||||
	"k8s.io/kubernetes/pkg/api/legacyscheme"
 | 
						"k8s.io/kubernetes/pkg/api/legacyscheme"
 | 
				
			||||||
	api "k8s.io/kubernetes/pkg/apis/core"
 | 
						api "k8s.io/kubernetes/pkg/apis/core"
 | 
				
			||||||
@@ -96,7 +96,7 @@ func doRoundTrip(t *testing.T, internalVersion schema.GroupVersion, externalVers
 | 
				
			|||||||
		return
 | 
							return
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	if !apiequality.Semantic.DeepEqual(item, unmarshalledObj) {
 | 
						if !apiequality.Semantic.DeepEqual(item, unmarshalledObj) {
 | 
				
			||||||
		t.Errorf("Object changed during JSON operations, diff: %v", diff.ObjectReflectDiff(item, unmarshalledObj))
 | 
							t.Errorf("Object changed during JSON operations, diff: %v", cmp.Diff(item, unmarshalledObj))
 | 
				
			||||||
		return
 | 
							return
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -114,7 +114,7 @@ func doRoundTrip(t *testing.T, internalVersion schema.GroupVersion, externalVers
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if !apiequality.Semantic.DeepEqual(item, newObj) {
 | 
						if !apiequality.Semantic.DeepEqual(item, newObj) {
 | 
				
			||||||
		t.Errorf("Object changed, diff: %v", diff.ObjectReflectDiff(item, newObj))
 | 
							t.Errorf("Object changed, diff: %v", cmp.Diff(item, newObj))
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user