Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ignore new unexported fields in the tests #7830

Merged
merged 2 commits into from
Feb 13, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading