@@ -380,7 +380,7 @@ func TestMetrics(t *testing.T) {
380380 ds := NewDatastore (ctx , epf , 0 )
381381 _ = ds .PoolSet (ctx , fakeClient , pooltuil .InferencePoolToEndpointPool (inferencePool ))
382382 for _ , pod := range test .storePods {
383- ds .PodUpdateOrAddIfNotExist (pod )
383+ ds .PodUpdateOrAddIfNotExist (ctx , pod )
384384 }
385385 time .Sleep (1 * time .Second ) // Give some time for the metrics to be fetched.
386386 if test .predict == nil {
@@ -414,15 +414,15 @@ func TestPods(t *testing.T) {
414414 existingPods : []* corev1.Pod {},
415415 wantPods : []* corev1.Pod {pod1 },
416416 op : func (ctx context.Context , ds Datastore ) {
417- ds .PodUpdateOrAddIfNotExist (pod1 )
417+ ds .PodUpdateOrAddIfNotExist (ctx , pod1 )
418418 },
419419 },
420420 {
421421 name : "Add new pod, with existing pods, should add" ,
422422 existingPods : []* corev1.Pod {pod1 },
423423 wantPods : []* corev1.Pod {pod1 , pod2 },
424424 op : func (ctx context.Context , ds Datastore ) {
425- ds .PodUpdateOrAddIfNotExist (pod2 )
425+ ds .PodUpdateOrAddIfNotExist (ctx , pod2 )
426426 },
427427 },
428428 {
@@ -457,7 +457,7 @@ func TestPods(t *testing.T) {
457457 t .Error (err )
458458 }
459459 for _ , pod := range test .existingPods {
460- ds .PodUpdateOrAddIfNotExist (pod )
460+ ds .PodUpdateOrAddIfNotExist (ctx , pod )
461461 }
462462
463463 test .op (ctx , ds )
@@ -613,7 +613,7 @@ func TestEndpointMetadata(t *testing.T) {
613613 },
614614 },
615615 op : func (ctx context.Context , ds Datastore ) {
616- ds .PodUpdateOrAddIfNotExist (pod1 )
616+ ds .PodUpdateOrAddIfNotExist (ctx , pod1 )
617617 },
618618 pool : inferencePool ,
619619 },
@@ -647,7 +647,7 @@ func TestEndpointMetadata(t *testing.T) {
647647 },
648648 },
649649 op : func (ctx context.Context , ds Datastore ) {
650- ds .PodUpdateOrAddIfNotExist (pod1 )
650+ ds .PodUpdateOrAddIfNotExist (ctx , pod1 )
651651 },
652652 pool : inferencePoolMultiTarget ,
653653 },
@@ -705,7 +705,7 @@ func TestEndpointMetadata(t *testing.T) {
705705 },
706706 },
707707 op : func (ctx context.Context , ds Datastore ) {
708- ds .PodUpdateOrAddIfNotExist (pod2 )
708+ ds .PodUpdateOrAddIfNotExist (ctx , pod2 )
709709 },
710710 pool : inferencePoolMultiTarget ,
711711 },
@@ -760,7 +760,7 @@ func TestEndpointMetadata(t *testing.T) {
760760 t .Error (err )
761761 }
762762 for _ , pod := range test .existingPods {
763- ds .PodUpdateOrAddIfNotExist (pod )
763+ ds .PodUpdateOrAddIfNotExist (ctx , pod )
764764 }
765765
766766 test .op (ctx , ds )
@@ -919,7 +919,7 @@ func TestActivePortFiltering(t *testing.T) {
919919
920920 // Add all pods
921921 for _ , pod := range test .pods {
922- ds .PodUpdateOrAddIfNotExist (pod )
922+ ds .PodUpdateOrAddIfNotExist (ctx , pod )
923923 }
924924
925925 // Check final endpoint count
@@ -1019,7 +1019,7 @@ func TestActivePortEndpointRemoval(t *testing.T) {
10191019 operations : []func (Datastore ){
10201020 // Update the pod to reduce active ports from 3 to 1
10211021 func (ds Datastore ) {
1022- ds .PodUpdateOrAddIfNotExist (updatedPod1 )
1022+ ds .PodUpdateOrAddIfNotExist (context . Background (), updatedPod1 )
10231023 },
10241024 },
10251025 wantEndpointCount : 1 , // Only port 8000 should remain active
@@ -1035,7 +1035,7 @@ func TestActivePortEndpointRemoval(t *testing.T) {
10351035 operations : []func (Datastore ){
10361036 // Update the pod to have no active ports
10371037 func (ds Datastore ) {
1038- ds .PodUpdateOrAddIfNotExist (inactivePod1 )
1038+ ds .PodUpdateOrAddIfNotExist (context . Background (), inactivePod1 )
10391039 },
10401040 },
10411041 wantEndpointCount : 0 , // No ports should remain active
@@ -1068,7 +1068,7 @@ func TestActivePortEndpointRemoval(t *testing.T) {
10681068 }
10691069
10701070 // Add the initial pod
1071- ds .PodUpdateOrAddIfNotExist (test .initialPod )
1071+ ds .PodUpdateOrAddIfNotExist (ctx , test .initialPod )
10721072
10731073 // Wait a bit for the datastore to process the pod
10741074 time .Sleep (100 * time .Millisecond )
@@ -1150,7 +1150,7 @@ func TestPodUpdateOrAddIfNotExist_ConcurrentPoolSet(t *testing.T) {
11501150 go func () {
11511151 defer wg .Done ()
11521152 for range 1000 {
1153- ds .PodUpdateOrAddIfNotExist (pod )
1153+ ds .PodUpdateOrAddIfNotExist (ctx , pod )
11541154 }
11551155 }()
11561156
0 commit comments