Skip to content

Commit 7fd5b0d

Browse files
committed
Undid test changes due to Datastore restore
Signed-off-by: Shmuel Kallner <[email protected]>
1 parent bae93df commit 7fd5b0d

File tree

8 files changed

+18
-33
lines changed

8 files changed

+18
-33
lines changed

pkg/epp/controller/inferenceobjective_reconciler_test.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,8 +160,7 @@ func TestInferenceObjectiveReconciler(t *testing.T) {
160160
WithObjects(initObjs...).
161161
Build()
162162
pmf := backendmetrics.NewPodMetricsFactory(&backendmetrics.FakePodMetricsClient{}, time.Second)
163-
ds := datastore.NewDatastore(t.Context(), 0)
164-
ds.SetEndpointFactory(pmf)
163+
ds := datastore.NewDatastore(t.Context(), pmf, 0)
165164
for _, m := range test.objectivessInStore {
166165
ds.ObjectiveSet(m)
167166
}

pkg/epp/controller/inferencepool_reconciler_test.go

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,7 @@ func TestInferencePoolReconciler(t *testing.T) {
114114
ctx := context.Background()
115115

116116
pmf := backendmetrics.NewPodMetricsFactory(&backendmetrics.FakePodMetricsClient{}, time.Second)
117-
ds := datastore.NewDatastore(ctx, 0)
118-
ds.SetEndpointFactory(pmf)
117+
ds := datastore.NewDatastore(ctx, pmf, 0)
119118
inferencePoolReconciler := &InferencePoolReconciler{Reader: fakeClient, Datastore: ds, PoolGKNN: gknn}
120119

121120
// Step 1: Inception, only ready pods matching pool1 are added to the store.
@@ -262,8 +261,7 @@ func TestXInferencePoolReconciler(t *testing.T) {
262261
ctx := context.Background()
263262

264263
pmf := backendmetrics.NewPodMetricsFactory(&backendmetrics.FakePodMetricsClient{}, time.Second)
265-
ds := datastore.NewDatastore(ctx, 0)
266-
ds.SetEndpointFactory(pmf)
264+
ds := datastore.NewDatastore(ctx, pmf, 0)
267265
inferencePoolReconciler := &InferencePoolReconciler{Reader: fakeClient, Datastore: ds, PoolGKNN: gknn}
268266

269267
// Step 1: Inception, only ready pods matching pool1 are added to the store.

pkg/epp/controller/pod_reconciler_test.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -196,8 +196,7 @@ func TestPodReconciler(t *testing.T) {
196196
Build()
197197

198198
// Configure the initial state of the datastore.
199-
store := datastore.NewDatastore(t.Context(), 0)
200-
store.SetEndpointFactory(pmf)
199+
store := datastore.NewDatastore(t.Context(), pmf, 0)
201200
_ = store.PoolSet(t.Context(), fakeClient, test.pool)
202201
for _, pod := range test.existingPods {
203202
store.PodUpdateOrAddIfNotExist(pod)

pkg/epp/datastore/datastore_test.go

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,7 @@ func TestPool(t *testing.T) {
8686
WithScheme(scheme).
8787
Build()
8888
pmf := backendmetrics.NewPodMetricsFactory(&backendmetrics.FakePodMetricsClient{}, time.Second)
89-
ds := NewDatastore(context.Background(), 0)
90-
ds.SetEndpointFactory(pmf)
89+
ds := NewDatastore(context.Background(), pmf, 0)
9190
_ = ds.PoolSet(context.Background(), fakeClient, tt.inferencePool)
9291
gotPool, gotErr := ds.PoolGet()
9392
if diff := cmp.Diff(tt.wantErr, gotErr, cmpopts.EquateErrors()); diff != "" {
@@ -194,8 +193,7 @@ func TestObjective(t *testing.T) {
194193
for _, test := range tests {
195194
t.Run(test.name, func(t *testing.T) {
196195
pmf := backendmetrics.NewPodMetricsFactory(&backendmetrics.FakePodMetricsClient{}, time.Second)
197-
ds := NewDatastore(t.Context(), 0)
198-
ds.SetEndpointFactory(pmf)
196+
ds := NewDatastore(t.Context(), pmf, 0)
199197
for _, m := range test.existingModels {
200198
ds.ObjectiveSet(m)
201199
}
@@ -329,8 +327,7 @@ func TestMetrics(t *testing.T) {
329327
WithScheme(scheme).
330328
Build()
331329
pmf := backendmetrics.NewPodMetricsFactory(test.pmc, time.Millisecond)
332-
ds := NewDatastore(ctx, 0)
333-
ds.SetEndpointFactory(pmf)
330+
ds := NewDatastore(ctx, pmf, 0)
334331
_ = ds.PoolSet(ctx, fakeClient, inferencePool)
335332
for _, pod := range test.storePods {
336333
ds.PodUpdateOrAddIfNotExist(pod)
@@ -398,8 +395,7 @@ func TestPods(t *testing.T) {
398395
t.Run(test.name, func(t *testing.T) {
399396
ctx := context.Background()
400397
pmf := backendmetrics.NewPodMetricsFactory(&backendmetrics.FakePodMetricsClient{}, time.Second)
401-
ds := NewDatastore(t.Context(), 0)
402-
ds.SetEndpointFactory(pmf)
398+
ds := NewDatastore(t.Context(), pmf, 0)
403399
fakeClient := fake.NewFakeClient()
404400
if err := ds.PoolSet(ctx, fakeClient, inferencePool); err != nil {
405401
t.Error(err)
@@ -583,8 +579,7 @@ func TestPodInfo(t *testing.T) {
583579
t.Run(test.name, func(t *testing.T) {
584580
ctx := context.Background()
585581
pmf := backendmetrics.NewPodMetricsFactory(&backendmetrics.FakePodMetricsClient{}, time.Second)
586-
ds := NewDatastore(t.Context(), 0)
587-
ds.SetEndpointFactory(pmf)
582+
ds := NewDatastore(t.Context(), pmf, 0)
588583
fakeClient := fake.NewFakeClient()
589584
if err := ds.PoolSet(ctx, fakeClient, test.pool); err != nil {
590585
t.Error(err)

pkg/epp/metrics/collectors/inference_pool_test.go

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,7 @@ var (
5050

5151
func TestNoMetricsCollected(t *testing.T) {
5252
pmf := backendmetrics.NewPodMetricsFactory(&backendmetrics.FakePodMetricsClient{}, time.Second)
53-
ds := datastore.NewDatastore(context.Background(), 0)
54-
ds.SetEndpointFactory(pmf)
53+
ds := datastore.NewDatastore(context.Background(), pmf, 0)
5554

5655
collector := &inferencePoolMetricsCollector{
5756
ds: ds,
@@ -69,8 +68,7 @@ func TestMetricsCollected(t *testing.T) {
6968
},
7069
}
7170
pmf := backendmetrics.NewPodMetricsFactory(pmc, time.Millisecond)
72-
ds := datastore.NewDatastore(context.Background(), 0)
73-
ds.SetEndpointFactory(pmf)
71+
ds := datastore.NewDatastore(context.Background(), pmf, 0)
7472

7573
scheme := runtime.NewScheme()
7674
fakeClient := fake.NewClientBuilder().

pkg/epp/requestcontrol/director_test.go

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -120,8 +120,7 @@ func TestDirector_HandleRequest(t *testing.T) {
120120

121121
// Datastore setup
122122
pmf := backendmetrics.NewPodMetricsFactory(&backendmetrics.FakePodMetricsClient{}, time.Second)
123-
ds := datastore.NewDatastore(t.Context(), 0)
124-
ds.SetEndpointFactory(pmf)
123+
ds := datastore.NewDatastore(t.Context(), pmf, 0)
125124
ds.ObjectiveSet(ioFoodReview)
126125
ds.ObjectiveSet(ioFoodReviewResolve)
127126
ds.ObjectiveSet(ioFoodReviewSheddable)
@@ -595,8 +594,7 @@ func TestGetRandomPod(t *testing.T) {
595594
for _, test := range tests {
596595
t.Run(test.name, func(t *testing.T) {
597596
pmf := backendmetrics.NewPodMetricsFactory(&backendmetrics.FakePodMetricsClient{}, time.Millisecond)
598-
ds := datastore.NewDatastore(t.Context(), 0)
599-
ds.SetEndpointFactory(pmf)
597+
ds := datastore.NewDatastore(t.Context(), pmf, 0)
600598
err := ds.PoolSet(t.Context(), fakeClient, pool)
601599
if err != nil {
602600
t.Errorf("unexpected error setting pool: %s", err)
@@ -621,7 +619,7 @@ func TestDirector_HandleResponseReceived(t *testing.T) {
621619
pr1 := newTestResponseReceived("pr1")
622620

623621
ctx := logutil.NewTestLoggerIntoContext(context.Background())
624-
ds := datastore.NewDatastore(t.Context(), 0)
622+
ds := datastore.NewDatastore(t.Context(), nil, 0)
625623
mockSched := &mockScheduler{}
626624
director := NewDirectorWithConfig(ds, mockSched, &mockAdmissionController{}, NewConfig().WithResponseReceivedPlugins(pr1))
627625

@@ -658,7 +656,7 @@ func TestDirector_HandleResponseStreaming(t *testing.T) {
658656
ps1 := newTestResponseStreaming("ps1")
659657

660658
ctx := logutil.NewTestLoggerIntoContext(context.Background())
661-
ds := datastore.NewDatastore(t.Context(), 0)
659+
ds := datastore.NewDatastore(t.Context(), nil, 0)
662660
mockSched := &mockScheduler{}
663661
director := NewDirectorWithConfig(ds, mockSched, nil, NewConfig().WithResponseStreamingPlugins(ps1))
664662

@@ -694,7 +692,7 @@ func TestDirector_HandleResponseComplete(t *testing.T) {
694692
pc1 := newTestResponseComplete("pc1")
695693

696694
ctx := logutil.NewTestLoggerIntoContext(context.Background())
697-
ds := datastore.NewDatastore(t.Context(), 0)
695+
ds := datastore.NewDatastore(t.Context(), nil, 0)
698696
mockSched := &mockScheduler{}
699697
director := NewDirectorWithConfig(ds, mockSched, nil, NewConfig().WithResponseCompletePlugins(pc1))
700698

test/integration/epp/hermetic_test.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1174,8 +1174,7 @@ func BeforeSuite() func() {
11741174
NamespacedName: types.NamespacedName{Namespace: testNamespace, Name: testPoolName},
11751175
GroupKind: schema.GroupKind{Group: v1.GroupVersion.Group, Kind: "InferencePool"},
11761176
}
1177-
serverRunner.Datastore = datastore.NewDatastore(context.Background(), 0)
1178-
serverRunner.Datastore.SetEndpointFactory(pmf)
1177+
serverRunner.Datastore = datastore.NewDatastore(context.Background(), pmf, 0)
11791178

11801179
kvCacheUtilizationScorer := scorer.NewKVCacheUtilizationScorer()
11811180
queueingScorer := scorer.NewQueueScorer()

test/utils/server.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,7 @@ func PrepareForTestStreamingServer(objectives []*v1alpha2.InferenceObjective, po
5050

5151
pmc := &metrics.FakePodMetricsClient{}
5252
pmf := metrics.NewPodMetricsFactory(pmc, time.Second)
53-
ds := datastore.NewDatastore(ctx, 0)
54-
ds.SetEndpointFactory(pmf)
53+
ds := datastore.NewDatastore(ctx, pmf, 0)
5554

5655
initObjs := []client.Object{}
5756
for _, objective := range objectives {

0 commit comments

Comments
 (0)