Skip to content

Commit

Permalink
Merge pull request #7830 from kushagra98/master
Browse files Browse the repository at this point in the history
Ignore new unexported fields in the tests
  • Loading branch information
k8s-ci-robot authored Feb 13, 2025
2 parents 6cacce1 + ea72adf commit aae2e8f
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1119,6 +1119,7 @@ func validTestCases(t *testing.T, snapshotName string) []modificationTestCase {
// We don't care about this field staying the same, and it differs because it's a global counter bumped on every AddPod.
cmpopts.IgnoreFields(schedulerframework.NodeInfo{}, "Generation"),
cmp.AllowUnexported(framework.NodeInfo{}, schedulerframework.NodeInfo{}),
cmpopts.IgnoreUnexported(schedulerframework.PodInfo{}),
cmpopts.SortSlices(func(i1, i2 *framework.NodeInfo) bool { return i1.Node().Name < i2.Node().Name }),
IgnoreObjectOrder[*resourceapi.ResourceClaim](),
IgnoreObjectOrder[*resourceapi.ResourceSlice](),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -572,6 +572,7 @@ func TestSnapshotWrapSchedulerNodeInfo(t *testing.T) {
t.Fatalf("Snapshot.WrapSchedulerNodeInfo(): unexpected error (-want +got): %s", diff)
}
cmpOpts := []cmp.Option{cmpopts.EquateEmpty(), cmp.AllowUnexported(framework.NodeInfo{}, schedulerframework.NodeInfo{}),
cmpopts.IgnoreUnexported(schedulerframework.PodInfo{}),
test.IgnoreObjectOrder[*resourceapi.ResourceClaim](), test.IgnoreObjectOrder[*resourceapi.ResourceSlice]()}
if diff := cmp.Diff(tc.wantNodeInfo, nodeInfo, cmpOpts...); diff != "" {
t.Errorf("Snapshot.WrapSchedulerNodeInfo(): unexpected output (-want +got): %s", diff)
Expand Down
2 changes: 2 additions & 0 deletions cluster-autoscaler/simulator/framework/infos_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,7 @@ func TestNodeInfo(t *testing.T) {
cmpopts.SortSlices(func(p1, p2 *schedulerframework.PodInfo) bool {
return p1.Pod.Name < p2.Pod.Name
}),
cmpopts.IgnoreUnexported(schedulerframework.PodInfo{}),
}
if diff := cmp.Diff(tc.wantSchedNodeInfo, wrappedNodeInfo.ToScheduler(), nodeInfoCmpOpts...); diff != "" {
t.Errorf("ToScheduler() output differs from expected, diff (-want +got): %s", diff)
Expand Down Expand Up @@ -297,6 +298,7 @@ func TestDeepCopyNodeInfo(t *testing.T) {
// We don't care about this field staying the same, and it differs because it's a global counter bumped
// on every AddPod.
cmpopts.IgnoreFields(schedulerframework.NodeInfo{}, "Generation"),
cmpopts.IgnoreUnexported(schedulerframework.PodInfo{}),
); diff != "" {
t.Errorf("nodeInfo differs after DeepCopyNodeInfo, diff (-want +got): %s", diff)
}
Expand Down

0 comments on commit aae2e8f

Please sign in to comment.