@@ -26,6 +26,7 @@ import (
26
26
corev1 "k8s.io/api/core/v1"
27
27
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
28
28
"k8s.io/apimachinery/pkg/types"
29
+ "sigs.k8s.io/gateway-api-inference-extension/api/v1alpha2"
29
30
)
30
31
31
32
var (
@@ -59,8 +60,9 @@ func TestMetricsRefresh(t *testing.T) {
59
60
ctx := context .Background ()
60
61
pmc := & FakePodMetricsClient {}
61
62
pmf := NewPodMetricsFactory (pmc , time .Millisecond )
63
+
62
64
// The refresher is initialized with empty metrics.
63
- pm := pmf .NewPodMetrics (ctx , pod1 , 8000 )
65
+ pm := pmf .NewPodMetrics (ctx , pod1 , & fakeDataStore {} )
64
66
65
67
namespacedName := types.NamespacedName {Name : pod1 .Name , Namespace : pod1 .Namespace }
66
68
// Use SetRes to simulate an update of metrics from the pod.
@@ -78,3 +80,17 @@ func TestMetricsRefresh(t *testing.T) {
78
80
// Still expect the same condition (no metrics update).
79
81
assert .EventuallyWithT (t , condition , time .Second , time .Millisecond )
80
82
}
83
+
84
+ type fakeDataStore struct {}
85
+
86
+ func (f * fakeDataStore ) PoolGet () (* v1alpha2.InferencePool , error ) {
87
+ return & v1alpha2.InferencePool {Spec : v1alpha2.InferencePoolSpec {TargetPortNumber : 8000 }}, nil
88
+ }
89
+ func (f * fakeDataStore ) PodGetAll () []PodMetrics {
90
+ // Not implemented.
91
+ return nil
92
+ }
93
+ func (f * fakeDataStore ) PodList (func (PodMetrics ) bool ) []PodMetrics {
94
+ // Not implemented.
95
+ return nil
96
+ }
0 commit comments