Skip to content

Commit a963d95

Browse files
authored
ignore score in scheduler unit test (#234)
1 parent 36406ef commit a963d95

File tree

1 file changed

+8
-12
lines changed

1 file changed

+8
-12
lines changed

pkg/scheduling/pd/scheduler_test.go

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import (
66

77
"github.com/go-logr/logr/testr"
88
"github.com/google/go-cmp/cmp"
9+
"github.com/google/go-cmp/cmp/cmpopts"
910
"github.com/stretchr/testify/assert"
1011
k8stypes "k8s.io/apimachinery/pkg/types"
1112
"sigs.k8s.io/controller-runtime/pkg/log"
@@ -57,14 +58,12 @@ func TestPDSchedule(t *testing.T) {
5758
ProfileResults: map[string]*types.ProfileRunResult{
5859
decode: {
5960
TargetPod: &types.ScoredPod{
60-
Pod: pod2,
61-
Score: 0.5,
61+
Pod: pod2,
6262
},
6363
},
6464
prefill: {
6565
TargetPod: &types.ScoredPod{
66-
Pod: pod1,
67-
Score: 0.0,
66+
Pod: pod1,
6867
},
6968
},
7069
},
@@ -75,8 +74,7 @@ func TestPDSchedule(t *testing.T) {
7574
ProfileResults: map[string]*types.ProfileRunResult{
7675
decode: {
7776
TargetPod: &types.ScoredPod{
78-
Pod: pod2,
79-
Score: 0.5,
77+
Pod: pod2,
8078
},
8179
},
8280
},
@@ -154,14 +152,12 @@ func TestPDSchedule(t *testing.T) {
154152
ProfileResults: map[string]*types.ProfileRunResult{
155153
decode: {
156154
TargetPod: &types.ScoredPod{
157-
Pod: noRolePod1,
158-
Score: 0.4921875,
155+
Pod: noRolePod1,
159156
},
160157
},
161158
prefill: {
162159
TargetPod: &types.ScoredPod{
163-
Pod: pod1,
164-
Score: 0.0,
160+
Pod: pod1,
165161
},
166162
},
167163
},
@@ -217,7 +213,7 @@ func TestPDSchedule(t *testing.T) {
217213
t.Errorf("Unexpected error, got %v, want %v", err, test.err)
218214
}
219215

220-
if diff := cmp.Diff(test.wantRes, got); diff != "" {
216+
if diff := cmp.Diff(test.wantRes, got, cmpopts.IgnoreFields(types.ScoredPod{}, "Score")); diff != "" {
221217
t.Errorf("Unexpected output (-want +got): %v", diff)
222218
}
223219

@@ -227,7 +223,7 @@ func TestPDSchedule(t *testing.T) {
227223
t.Errorf("Unexpected error in schedule call, got %v, want %v", err, test.err)
228224
}
229225

230-
if diff := cmp.Diff(test.wantRes2, got); diff != "" {
226+
if diff := cmp.Diff(test.wantRes2, got, cmpopts.IgnoreFields(types.ScoredPod{}, "Score")); diff != "" {
231227
t.Errorf("Unexpected output in subsequent schedule call (-want +got): %v", diff)
232228
}
233229
}

0 commit comments

Comments
 (0)