Skip to content

Commit f5bb1ae

Browse files
committed
undo gofumpt
Signed-off-by: Maroon Ayoub <[email protected]>
1 parent 634c1fe commit f5bb1ae

File tree

14 files changed

+32
-39
lines changed

14 files changed

+32
-39
lines changed

cmd/epp/main.go

+1
Original file line numberDiff line numberDiff line change
@@ -314,4 +314,5 @@ func verifyMetricMapping(mapping backendmetrics.MetricMapping, logger logr.Logge
314314
if mapping.LoraRequestInfo == nil {
315315
logger.Info("Not scraping metric: LoraRequestInfo")
316316
}
317+
317318
}

pkg/epp/backend/metrics/fake.go

-2
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,9 @@ func (fpm *FakePodMetrics) String() string {
4040
func (fpm *FakePodMetrics) GetPod() *Pod {
4141
return fpm.Pod
4242
}
43-
4443
func (fpm *FakePodMetrics) GetMetrics() *Metrics {
4544
return fpm.Metrics
4645
}
47-
4846
func (fpm *FakePodMetrics) UpdatePod(pod *corev1.Pod) {
4947
fpm.Pod = toInternalPod(pod)
5048
}

pkg/epp/backend/metrics/metrics.go

+1
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ func (p *PodMetricsClientImpl) FetchMetrics(
4747
existing *Metrics,
4848
port int32,
4949
) (*Metrics, error) {
50+
5051
// Currently the metrics endpoint is hard-coded, which works with vLLM.
5152
// TODO(https://github.com/kubernetes-sigs/gateway-api-inference-extension/issues/16): Consume this from InferencePool config.
5253
url := "http://" + pod.Address + ":" + strconv.Itoa(int(port)) + "/metrics"

pkg/epp/backend/metrics/metrics_test.go

+3
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ func makeMetricFamily(name string, metrics ...*dto.Metric) *dto.MetricFamily {
5858
// --- Tests ---
5959

6060
func TestGetMetric(t *testing.T) {
61+
6162
metricFamilies := map[string]*dto.MetricFamily{
6263
"metric1": makeMetricFamily("metric1",
6364
makeMetric(map[string]string{"label1": "value1"}, 1.0, 1000),
@@ -165,6 +166,7 @@ func TestGetMetric(t *testing.T) {
165166

166167
for _, tt := range tests {
167168
t.Run(tt.name, func(t *testing.T) {
169+
168170
gotMetric, err := p.getMetric(metricFamilies, tt.spec)
169171

170172
if tt.wantError {
@@ -238,6 +240,7 @@ func TestLabelsMatch(t *testing.T) {
238240
}
239241

240242
func TestGetLatestLoraMetric(t *testing.T) {
243+
241244
testCases := []struct {
242245
name string
243246
metricFamilies map[string]*dto.MetricFamily

pkg/epp/backend/metrics/pod_metrics_test.go

-2
Original file line numberDiff line numberDiff line change
@@ -88,12 +88,10 @@ type fakeDataStore struct{}
8888
func (f *fakeDataStore) PoolGet() (*v1alpha2.InferencePool, error) {
8989
return &v1alpha2.InferencePool{Spec: v1alpha2.InferencePoolSpec{TargetPortNumber: 8000}}, nil
9090
}
91-
9291
func (f *fakeDataStore) PodGetAll() []PodMetrics {
9392
// Not implemented.
9493
return nil
9594
}
96-
9795
func (f *fakeDataStore) PodList(func(PodMetrics) bool) []PodMetrics {
9896
// Not implemented.
9997
return nil

pkg/epp/controller/inferencemodel_reconciler_test.go

+1
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,7 @@ func TestInferenceModelReconciler(t *testing.T) {
227227
if diff := diffStore(ds, diffStoreParams{wantPool: pool, wantModels: test.wantModels}); diff != "" {
228228
t.Errorf("Unexpected diff (+got/-want): %s", diff)
229229
}
230+
230231
})
231232
}
232233
}

pkg/epp/datastore/datastore.go

+3-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,9 @@ const (
3838
ModelNameIndexKey = "spec.modelName"
3939
)
4040

41-
var errPoolNotSynced = errors.New("InferencePool is not initialized in data store")
41+
var (
42+
errPoolNotSynced = errors.New("InferencePool is not initialized in data store")
43+
)
4244

4345
// The datastore is a local cache of relevant data for the given InferencePool (currently all pulled from k8s-api)
4446
type Datastore interface {

pkg/epp/datastore/datastore_test.go

+2
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,7 @@ func TestModel(t *testing.T) {
204204
existing := ds.ModelDelete(types.NamespacedName{Name: model1ts.Name, Namespace: model1ts.Namespace})
205205
got := ds.ModelGet(tsModel)
206206
return existing != nil && got == nil
207+
207208
},
208209
wantOpResult: true,
209210
wantModels: []*v1alpha2.InferenceModel{model2chat},
@@ -225,6 +226,7 @@ func TestModel(t *testing.T) {
225226
if diff := testutil.DiffModelLists(test.wantModels, ds.ModelGetAll()); diff != "" {
226227
t.Errorf("Unexpected models diff: %s", diff)
227228
}
229+
228230
})
229231
}
230232
}

pkg/epp/scheduling/plugins/filter/filter.go

+1
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,7 @@ var LoRAAffinityFilter = &baseFilter{
214214
// - Filtered slice of pod metrics based on affinity and availability
215215
// - Error if any issues occur during filtering
216216
func loRASoftAffinityFilterFunc(ctx *types.SchedulingContext, pods []types.Pod) []types.Pod {
217+
217218
// Pre-allocate slices with estimated capacity
218219
filtered_affinity := make([]types.Pod, 0, len(pods))
219220
filtered_available := make([]types.Pod, 0, len(pods))

pkg/epp/scheduling/scheduler_test.go

+1
Original file line numberDiff line numberDiff line change
@@ -536,6 +536,7 @@ func (tp *TestPlugin) Filter(ctx *types.SchedulingContext, pods []types.Pod) []t
536536
tp.ReceivedRequestHeaders[key] = value
537537
}
538538
return findPods(ctx, tp.FilterRes...)
539+
539540
}
540541

541542
func (tp *TestPlugin) Score(ctx *types.SchedulingContext, pods []types.Pod) map[types.Pod]float64 {

test/e2e/epp/e2e_test.go

+1
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ var _ = ginkgo.Describe("InferencePool", func() {
8787

8888
return nil
8989
}, readyTimeout, curlInterval).Should(gomega.Succeed())
90+
9091
})
9192
})
9293
})

test/integration/bbr/hermetic_test.go

+2-4
Original file line numberDiff line numberDiff line change
@@ -122,8 +122,7 @@ func TestFullDuplexStreamed_BodyBasedRouting(t *testing.T) {
122122
RawValue: []byte("foo"),
123123
},
124124
},
125-
},
126-
},
125+
}},
127126
},
128127
},
129128
},
@@ -188,8 +187,7 @@ func TestFullDuplexStreamed_BodyBasedRouting(t *testing.T) {
188187
RawValue: []byte("sql-lora-sheddable"),
189188
},
190189
},
191-
},
192-
},
190+
}},
193191
},
194192
},
195193
},

test/integration/epp/hermetic_test.go

+15-30
Original file line numberDiff line numberDiff line change
@@ -121,8 +121,7 @@ func TestFullDuplexStreamed_KubeInferenceModelRequest(t *testing.T) {
121121
KVCacheUsagePercent: 0.2,
122122
},
123123
},
124-
wantMetrics: map[string]string{
125-
`inference_model_request_total`: `
124+
wantMetrics: map[string]string{`inference_model_request_total`: `
126125
# HELP inference_model_request_total [ALPHA] Counter of inference model requests broken out for each model and target model.
127126
# TYPE inference_model_request_total counter
128127
inference_model_request_total{model_name="my-model",target_model_name="my-model-12345"} 1
@@ -154,8 +153,7 @@ func TestFullDuplexStreamed_KubeInferenceModelRequest(t *testing.T) {
154153
RawValue: []byte(strconv.Itoa(76)),
155154
},
156155
},
157-
},
158-
},
156+
}},
159157
},
160158
},
161159
},
@@ -239,8 +237,7 @@ func TestFullDuplexStreamed_KubeInferenceModelRequest(t *testing.T) {
239237
RawValue: []byte(strconv.Itoa(76)),
240238
},
241239
},
242-
},
243-
},
240+
}},
244241
},
245242
},
246243
},
@@ -324,8 +321,7 @@ func TestFullDuplexStreamed_KubeInferenceModelRequest(t *testing.T) {
324321
RawValue: []byte(strconv.Itoa(76)),
325322
},
326323
},
327-
},
328-
},
324+
}},
329325
},
330326
},
331327
},
@@ -458,8 +454,7 @@ func TestFullDuplexStreamed_KubeInferenceModelRequest(t *testing.T) {
458454
RawValue: []byte(strconv.Itoa(76)),
459455
},
460456
},
461-
},
462-
},
457+
}},
463458
},
464459
},
465460
},
@@ -570,8 +565,7 @@ func TestFullDuplexStreamed_KubeInferenceModelRequest(t *testing.T) {
570565
RawValue: []byte(strconv.Itoa(76)),
571566
},
572567
},
573-
},
574-
},
568+
}},
575569
},
576570
},
577571
},
@@ -682,8 +676,7 @@ func TestFullDuplexStreamed_KubeInferenceModelRequest(t *testing.T) {
682676
RawValue: []byte(strconv.Itoa(74)),
683677
},
684678
},
685-
},
686-
},
679+
}},
687680
},
688681
},
689682
},
@@ -931,40 +924,35 @@ func TestFullDuplexStreamed_KubeInferenceModelRequest(t *testing.T) {
931924
Request: &extProcPb.ProcessingRequest_ResponseBody{
932925
ResponseBody: &extProcPb.HttpBody{
933926
Body: []byte(`data: {"id":"cmpl-0fee233f-7d56-404a-acd3-4dad775d03d9","object":"text_completion","created":1741379018,"model":"food-review-1","choices":[{"index":0,"text":"NEVER","logprobs":null,"finish_reason":null,"stop_reason":null}],"usage":null}`),
934-
EndOfStream: false,
935-
},
927+
EndOfStream: false},
936928
},
937929
},
938930
{
939931
Request: &extProcPb.ProcessingRequest_ResponseBody{
940932
ResponseBody: &extProcPb.HttpBody{
941933
Body: []byte(`data: {"id":"cmpl-0fee233f-7d56-404a-acd3-4dad775d03d9","object":"text_completion","created":1741379018,"model":"food-review-1","choices":[{"index":0,"text":"GONNA","logprobs":null,"finish_reason":null,"stop_reason":null}],"usage":null}`),
942-
EndOfStream: false,
943-
},
934+
EndOfStream: false},
944935
},
945936
},
946937
{
947938
Request: &extProcPb.ProcessingRequest_ResponseBody{
948939
ResponseBody: &extProcPb.HttpBody{
949940
Body: []byte(`data: {"id":"cmpl-0fee233f-7d56-404a-acd3-4dad775d03d9","object":"text_completion","created":1741379018,"model":"food-review-1","choices":[{"index":0,"text":"GIVE","logprobs":null,"finish_reason":null,"stop_reason":null}],"usage":null}`),
950-
EndOfStream: false,
951-
},
941+
EndOfStream: false},
952942
},
953943
},
954944
{
955945
Request: &extProcPb.ProcessingRequest_ResponseBody{
956946
ResponseBody: &extProcPb.HttpBody{
957947
Body: []byte(`data: {"id":"cmpl-0fee233f-7d56-404a-acd3-4dad775d03d9","object":"text_completion","created":1741379018,"model":"food-review-1","choices":[{"index":0,"text":"YOU","logprobs":null,"finish_reason":null,"stop_reason":null}],"usage":null}`),
958-
EndOfStream: false,
959-
},
948+
EndOfStream: false},
960949
},
961950
},
962951
{
963952
Request: &extProcPb.ProcessingRequest_ResponseBody{
964953
ResponseBody: &extProcPb.HttpBody{
965954
Body: []byte(`data: {"id":"cmpl-0fee233f-7d56-404a-acd3-4dad775d03d9","object":"text_completion","created":1741379018,"model":"food-review-1","choices":[{"index":0,"text":"UP","logprobs":null,"finish_reason":null,"stop_reason":null}],"usage":null}`),
966-
EndOfStream: false,
967-
},
955+
EndOfStream: false},
968956
},
969957
},
970958
{
@@ -973,16 +961,14 @@ func TestFullDuplexStreamed_KubeInferenceModelRequest(t *testing.T) {
973961
Body: []byte(`data: {"id":"cmpl-0fee233f-7d56-404a-acd3-4dad775d03d9","object":"text_completion","created":1741379018,"model":"food-review-1","choices":[],"usage":{"prompt_tokens":7,"total_tokens":17,"completion_tokens":10}}
974962
data: [DONE]`,
975963
),
976-
EndOfStream: false,
977-
},
964+
EndOfStream: false},
978965
},
979966
},
980967
{
981968
Request: &extProcPb.ProcessingRequest_ResponseBody{
982969
ResponseBody: &extProcPb.HttpBody{
983970
Body: []byte(""),
984-
EndOfStream: true,
985-
},
971+
EndOfStream: true},
986972
},
987973
},
988974
},
@@ -1186,8 +1172,7 @@ func TestFullDuplexStreamed_KubeInferenceModelRequest(t *testing.T) {
11861172
RawValue: []byte("192.168.1.1:8000"),
11871173
},
11881174
},
1189-
},
1190-
},
1175+
}},
11911176
},
11921177
},
11931178
},

test/utils/utils.go

+1
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,7 @@ func ExecCommandInPod(
240240
podNamespace, podName, containerName string,
241241
cmd []string,
242242
) (string, error) {
243+
243244
parameterCodec := runtime.NewParameterCodec(scheme)
244245

245246
req := kubeClient.CoreV1().RESTClient().

0 commit comments

Comments
 (0)