Merge pull request #119146 from xuexu6666/xuexu6666/ControllerUtilUseCmpDiff
Use cmp diff in controller_util_test.go
This commit is contained in:
		@@ -54,6 +54,7 @@ import (
 | 
				
			|||||||
	testingclock "k8s.io/utils/clock/testing"
 | 
						testingclock "k8s.io/utils/clock/testing"
 | 
				
			||||||
	"k8s.io/utils/pointer"
 | 
						"k8s.io/utils/pointer"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						"github.com/google/go-cmp/cmp"
 | 
				
			||||||
	"github.com/stretchr/testify/assert"
 | 
						"github.com/stretchr/testify/assert"
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -397,10 +398,9 @@ func TestActivePodFiltering(t *testing.T) {
 | 
				
			|||||||
		gotNames.Insert(pod.Name)
 | 
							gotNames.Insert(pod.Name)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	assert.Equal(t, 0, expectedNames.Difference(gotNames).Len(),
 | 
						if diff := cmp.Diff(expectedNames.List(), gotNames.List()); diff != "" {
 | 
				
			||||||
		"expected %v, got %v", expectedNames.List(), gotNames.List())
 | 
							t.Errorf("Active pod names (-want,+got):\n%s", diff)
 | 
				
			||||||
	assert.Equal(t, 0, gotNames.Difference(expectedNames).Len(),
 | 
						}
 | 
				
			||||||
		"expected %v, got %v", expectedNames.List(), gotNames.List())
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func TestSortingActivePods(t *testing.T) {
 | 
					func TestSortingActivePods(t *testing.T) {
 | 
				
			||||||
@@ -618,10 +618,9 @@ func TestActiveReplicaSetsFiltering(t *testing.T) {
 | 
				
			|||||||
		gotNames.Insert(rs.Name)
 | 
							gotNames.Insert(rs.Name)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	assert.Equal(t, 0, expectedNames.Difference(gotNames).Len(),
 | 
						if diff := cmp.Diff(expectedNames.List(), gotNames.List()); diff != "" {
 | 
				
			||||||
		"expected %v, got %v", expectedNames.List(), gotNames.List())
 | 
							t.Errorf("Active replica set names (-want,+got):\n%s", diff)
 | 
				
			||||||
	assert.Equal(t, 0, gotNames.Difference(expectedNames).Len(),
 | 
						}
 | 
				
			||||||
		"expected %v, got %v", expectedNames.List(), gotNames.List())
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func TestComputeHash(t *testing.T) {
 | 
					func TestComputeHash(t *testing.T) {
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user