Skip to content

Commit d2591d2

Browse files
committed
Fix test
1 parent 98b9371 commit d2591d2

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

pkg/epp/controller/inferencemodel_reconciler_test.go

+9-5
Original file line numberDiff line numberDiff line change
@@ -192,11 +192,15 @@ func TestInferenceModelReconciler(t *testing.T) {
192192
WithIndex(&v1alpha2.InferenceModel{}, datastore.ModelNameIndexKey, indexInferenceModelsByModelName).
193193
Build()
194194
pmf := backendmetrics.NewPodMetricsFactory(&backendmetrics.FakePodMetricsClient{}, time.Second)
195-
datastore := datastore.NewFakeDatastore(t.Context(), pmf, nil, test.modelsInStore, pool)
195+
ds := datastore.NewDatastore(t.Context(), pmf)
196+
for _, m := range test.modelsInStore {
197+
ds.ModelSetIfOlder(m)
198+
}
199+
ds.PoolSet(pool)
196200
reconciler := &InferenceModelReconciler{
197201
Client: fakeClient,
198202
Record: record.NewFakeRecorder(10),
199-
Datastore: datastore,
203+
Datastore: ds,
200204
PoolNamespacedName: types.NamespacedName{Name: pool.Name, Namespace: pool.Namespace},
201205
}
202206
if test.incomingReq == nil {
@@ -213,11 +217,11 @@ func TestInferenceModelReconciler(t *testing.T) {
213217
t.Errorf("Unexpected result diff (+got/-want): %s", diff)
214218
}
215219

216-
if len(test.wantModels) != len(datastore.ModelGetAll()) {
217-
t.Errorf("Unexpected; want: %d, got:%d", len(test.wantModels), len(datastore.ModelGetAll()))
220+
if len(test.wantModels) != len(ds.ModelGetAll()) {
221+
t.Errorf("Unexpected; want: %d, got:%d", len(test.wantModels), len(ds.ModelGetAll()))
218222
}
219223

220-
if diff := diffStore(datastore, diffStoreParams{wantPool: pool, wantModels: test.wantModels}); diff != "" {
224+
if diff := diffStore(ds, diffStoreParams{wantPool: pool, wantModels: test.wantModels}); diff != "" {
221225
t.Errorf("Unexpected diff (+got/-want): %s", diff)
222226
}
223227

0 commit comments

Comments
 (0)