@@ -30,6 +30,7 @@ import (
30
30
"sigs.k8s.io/controller-runtime/pkg/client/fake"
31
31
"sigs.k8s.io/gateway-api-inference-extension/api/v1alpha2"
32
32
backendmetrics "sigs.k8s.io/gateway-api-inference-extension/pkg/epp/backend/metrics"
33
+ podinfo "sigs.k8s.io/gateway-api-inference-extension/pkg/epp/backend/pod-info"
33
34
"sigs.k8s.io/gateway-api-inference-extension/pkg/epp/datastore"
34
35
)
35
36
48
49
)
49
50
50
51
func TestNoMetricsCollected (t * testing.T ) {
51
- pmf := backendmetrics .NewPodMetricsFactory (& backendmetrics.FakePodMetricsClient {}, time .Second )
52
- datastore := datastore .NewDatastore (context .Background (), pmf )
52
+ podInfoFactory := podinfo .NewPodInfoFactory (map [podinfo.Scraper ]* podinfo.ScraperConfig {
53
+ & backendmetrics.FakeMetricsScraper {}: podinfo .NewScraperConfig (time .Second , 5 * time .Second ),
54
+ })
55
+ datastore := datastore .NewDatastore (context .Background (), podInfoFactory )
53
56
54
57
collector := & inferencePoolMetricsCollector {
55
58
ds : datastore ,
@@ -61,13 +64,15 @@ func TestNoMetricsCollected(t *testing.T) {
61
64
}
62
65
63
66
func TestMetricsCollected (t * testing.T ) {
64
- pmc := & backendmetrics.FakePodMetricsClient {
67
+ fms := & backendmetrics.FakeMetricsScraper {
65
68
Res : map [types.NamespacedName ]* backendmetrics.Metrics {
66
69
pod1NamespacedName : pod1Metrics ,
67
70
},
68
71
}
69
- pmf := backendmetrics .NewPodMetricsFactory (pmc , time .Millisecond )
70
- ds := datastore .NewDatastore (context .Background (), pmf )
72
+ podInfoFactory := podinfo .NewPodInfoFactory (map [podinfo.Scraper ]* podinfo.ScraperConfig {
73
+ fms : podinfo .NewScraperConfig (time .Millisecond , 5 * time .Millisecond ),
74
+ })
75
+ ds := datastore .NewDatastore (context .Background (), podInfoFactory )
71
76
72
77
scheme := runtime .NewScheme ()
73
78
fakeClient := fake .NewClientBuilder ().
0 commit comments