@@ -23,8 +23,7 @@ import (
2323 "github.com/google/go-cmp/cmp"
2424 "github.com/google/uuid"
2525 k8stypes "k8s.io/apimachinery/pkg/types"
26- "sigs.k8s.io/gateway-api-inference-extension/pkg/epp/backend"
27- backendmetrics "sigs.k8s.io/gateway-api-inference-extension/pkg/epp/backend/metrics" // Import config for thresholds
26+ "sigs.k8s.io/gateway-api-inference-extension/pkg/epp/backend" // Import config for thresholds
2827 "sigs.k8s.io/gateway-api-inference-extension/pkg/epp/scheduling/types"
2928)
3029
@@ -51,7 +50,7 @@ func TestSchedulePlugins(t *testing.T) {
5150 tests := []struct {
5251 name string
5352 profile * SchedulerProfile
54- input []backendmetrics. PodMetrics
53+ input []types. Pod
5554 wantTargetPod k8stypes.NamespacedName
5655 targetPodScore float64
5756 // Number of expected pods to score (after filter)
@@ -65,10 +64,10 @@ func TestSchedulePlugins(t *testing.T) {
6564 WithScorers (NewWeightedScorer (tp1 , 1 ), NewWeightedScorer (tp2 , 1 )).
6665 WithPicker (pickerPlugin ).
6766 WithPostCyclePlugins (tp1 , tp2 ),
68- input : []backendmetrics. PodMetrics {
69- & backendmetrics. FakePodMetrics {Pod : & backend.Pod {NamespacedName : k8stypes.NamespacedName {Name : "pod1" }}},
70- & backendmetrics. FakePodMetrics {Pod : & backend.Pod {NamespacedName : k8stypes.NamespacedName {Name : "pod2" }}},
71- & backendmetrics. FakePodMetrics {Pod : & backend.Pod {NamespacedName : k8stypes.NamespacedName {Name : "pod3" }}},
67+ input : []types. Pod {
68+ & types. PodMetrics {Pod : & backend.Pod {NamespacedName : k8stypes.NamespacedName {Name : "pod1" }}},
69+ & types. PodMetrics {Pod : & backend.Pod {NamespacedName : k8stypes.NamespacedName {Name : "pod2" }}},
70+ & types. PodMetrics {Pod : & backend.Pod {NamespacedName : k8stypes.NamespacedName {Name : "pod3" }}},
7271 },
7372 wantTargetPod : k8stypes.NamespacedName {Name : "pod1" },
7473 targetPodScore : 1.1 ,
@@ -82,10 +81,10 @@ func TestSchedulePlugins(t *testing.T) {
8281 WithScorers (NewWeightedScorer (tp1 , 60 ), NewWeightedScorer (tp2 , 40 )).
8382 WithPicker (pickerPlugin ).
8483 WithPostCyclePlugins (tp1 , tp2 ),
85- input : []backendmetrics. PodMetrics {
86- & backendmetrics. FakePodMetrics {Pod : & backend.Pod {NamespacedName : k8stypes.NamespacedName {Name : "pod1" }}},
87- & backendmetrics. FakePodMetrics {Pod : & backend.Pod {NamespacedName : k8stypes.NamespacedName {Name : "pod2" }}},
88- & backendmetrics. FakePodMetrics {Pod : & backend.Pod {NamespacedName : k8stypes.NamespacedName {Name : "pod3" }}},
84+ input : []types. Pod {
85+ & types. PodMetrics {Pod : & backend.Pod {NamespacedName : k8stypes.NamespacedName {Name : "pod1" }}},
86+ & types. PodMetrics {Pod : & backend.Pod {NamespacedName : k8stypes.NamespacedName {Name : "pod2" }}},
87+ & types. PodMetrics {Pod : & backend.Pod {NamespacedName : k8stypes.NamespacedName {Name : "pod3" }}},
8988 },
9089 wantTargetPod : k8stypes.NamespacedName {Name : "pod1" },
9190 targetPodScore : 50 ,
@@ -99,10 +98,10 @@ func TestSchedulePlugins(t *testing.T) {
9998 WithScorers (NewWeightedScorer (tp1 , 1 ), NewWeightedScorer (tp2 , 1 )).
10099 WithPicker (pickerPlugin ).
101100 WithPostCyclePlugins (tp1 , tp2 ),
102- input : []backendmetrics. PodMetrics {
103- & backendmetrics. FakePodMetrics {Pod : & backend.Pod {NamespacedName : k8stypes.NamespacedName {Name : "pod1" }}},
104- & backendmetrics. FakePodMetrics {Pod : & backend.Pod {NamespacedName : k8stypes.NamespacedName {Name : "pod2" }}},
105- & backendmetrics. FakePodMetrics {Pod : & backend.Pod {NamespacedName : k8stypes.NamespacedName {Name : "pod3" }}},
101+ input : []types. Pod {
102+ & types. PodMetrics {Pod : & backend.Pod {NamespacedName : k8stypes.NamespacedName {Name : "pod1" }}},
103+ & types. PodMetrics {Pod : & backend.Pod {NamespacedName : k8stypes.NamespacedName {Name : "pod2" }}},
104+ & types. PodMetrics {Pod : & backend.Pod {NamespacedName : k8stypes.NamespacedName {Name : "pod3" }}},
106105 },
107106 numPodsToScore : 0 ,
108107 err : true , // no available pods to server after filter all
@@ -129,7 +128,7 @@ func TestSchedulePlugins(t *testing.T) {
129128 RequestId : uuid .NewString (),
130129 }
131130 // Run profile cycle
132- got , err := test .profile .Run (context .Background (), request , types .NewCycleState (), types . ToSchedulerPodMetrics ( test .input ) )
131+ got , err := test .profile .Run (context .Background (), request , types .NewCycleState (), test .input )
133132
134133 // Validate error state
135134 if test .err != (err != nil ) {
@@ -142,7 +141,7 @@ func TestSchedulePlugins(t *testing.T) {
142141
143142 // Validate output
144143 wantPod := & types.PodMetrics {
145- Pod : & backend.Pod {NamespacedName : test .wantTargetPod , Labels : make ( map [ string ] string ) },
144+ Pod : & backend.Pod {NamespacedName : test .wantTargetPod },
146145 }
147146 wantRes := & types.ProfileRunResult {
148147 TargetPod : wantPod ,
0 commit comments