@@ -55,6 +55,7 @@ func TestPrefixPluginCompletion(t *testing.T) {
5555 },
5656 },
5757 }
58+ plugin .PrepareRequestData (context .Background (), req1 , pods )
5859 scores := plugin .Score (context .Background (), types .NewCycleState (), req1 , pods )
5960 state , err := plugins .ReadPluginStateKey [* SchedulingContextState ](plugin .pluginState , req1 .RequestId , plugins .StateKey (plugin .TypedName ().String ()))
6061 assert .NoError (t , err )
@@ -87,6 +88,7 @@ func TestPrefixPluginCompletion(t *testing.T) {
8788 },
8889 },
8990 }
91+ plugin .PrepareRequestData (context .Background (), req2 , pods )
9092 scores = plugin .Score (context .Background (), types .NewCycleState (), req2 , pods )
9193 state , err = plugins .ReadPluginStateKey [* SchedulingContextState ](plugin .pluginState , req2 .RequestId , plugins .StateKey (plugin .TypedName ().String ()))
9294 assert .NoError (t , err )
@@ -118,6 +120,7 @@ func TestPrefixPluginCompletion(t *testing.T) {
118120 },
119121 },
120122 }
123+ plugin .PrepareRequestData (context .Background (), req3 , pods )
121124 scores = plugin .Score (context .Background (), types .NewCycleState (), req3 , pods )
122125 state , err = plugins .ReadPluginStateKey [* SchedulingContextState ](plugin .pluginState , req3 .RequestId , plugins .StateKey (plugin .TypedName ().String ()))
123126 assert .NoError (t , err )
@@ -148,6 +151,7 @@ func TestPrefixPluginCompletion(t *testing.T) {
148151 },
149152 },
150153 }
154+ plugin .PrepareRequestData (context .Background (), req4 , pods )
151155 scores = plugin .Score (context .Background (), types .NewCycleState (), req4 , pods )
152156 state , err = plugins .ReadPluginStateKey [* SchedulingContextState ](plugin .pluginState , req4 .RequestId , plugins .StateKey (plugin .TypedName ().String ()))
153157 assert .NoError (t , err )
@@ -178,6 +182,7 @@ func TestPrefixPluginCompletion(t *testing.T) {
178182 },
179183 },
180184 }
185+ plugin .PrepareRequestData (context .Background (), req5 , pods )
181186 scores = plugin .Score (context .Background (), types .NewCycleState (), req5 , pods )
182187 state , err = plugins .ReadPluginStateKey [* SchedulingContextState ](plugin .pluginState , req5 .RequestId , plugins .StateKey (plugin .TypedName ().String ()))
183188 assert .NoError (t , err )
@@ -223,6 +228,7 @@ func TestPrefixPluginChatCompletions(t *testing.T) {
223228 },
224229 },
225230 }
231+ plugin .PrepareRequestData (context .Background (), req1 , pods )
226232 scores := plugin .Score (context .Background (), types .NewCycleState (), req1 , pods )
227233 state , err := plugins .ReadPluginStateKey [* SchedulingContextState ](plugin .pluginState , req1 .RequestId , plugins .StateKey (plugin .TypedName ().String ()))
228234 assert .NoError (t , err )
@@ -258,6 +264,7 @@ func TestPrefixPluginChatCompletionsGrowth(t *testing.T) {
258264 },
259265 },
260266 }
267+ plugin .PrepareRequestData (context .Background (), req1 , pods )
261268 scores := plugin .Score (context .Background (), types .NewCycleState (), req1 , pods )
262269 state , err := plugins .ReadPluginStateKey [* SchedulingContextState ](plugin .pluginState , req1 .RequestId , plugins .StateKey (plugin .TypedName ().String ()))
263270 assert .NoError (t , err )
@@ -293,6 +300,7 @@ func TestPrefixPluginChatCompletionsGrowth(t *testing.T) {
293300 },
294301 },
295302 }
303+ plugin .PrepareRequestData (context .Background (), req2 , pods )
296304 scores = plugin .Score (context .Background (), types .NewCycleState (), req2 , pods )
297305 state , err = plugins .ReadPluginStateKey [* SchedulingContextState ](plugin .pluginState , req2 .RequestId , plugins .StateKey (plugin .TypedName ().String ()))
298306 assert .NoError (t , err )
@@ -328,6 +336,7 @@ func TestPrefixPluginChatCompletionsGrowth(t *testing.T) {
328336 },
329337 },
330338 }
339+ plugin .PrepareRequestData (context .Background (), req3 , pods )
331340 scores = plugin .Score (context .Background (), types .NewCycleState (), req3 , pods )
332341 state , err = plugins .ReadPluginStateKey [* SchedulingContextState ](plugin .pluginState , req3 .RequestId , plugins .StateKey (plugin .TypedName ().String ()))
333342 assert .NoError (t , err )
@@ -387,6 +396,7 @@ func BenchmarkPrefixPluginStress(b *testing.B) {
387396 }
388397
389398 b .ResetTimer ()
399+ plugin .PrepareRequestData (context .Background (), req , pods )
390400 // Benchmark the scoring operation
391401 scores := plugin .Score (context .Background (), types .NewCycleState (), req , pods )
392402 _ = scores // Use the result to prevent optimization
@@ -468,8 +478,9 @@ func BenchmarkPrefixPluginChatCompletionsStress(b *testing.B) {
468478 }
469479
470480 b .ResetTimer ()
471- for i := 0 ; i < b . N ; i ++ {
481+ for b . Loop () {
472482 // Benchmark the scoring operation
483+ plugin .PrepareRequestData (context .Background (), req , pods )
473484 scores := plugin .Score (context .Background (), types .NewCycleState (), req , pods )
474485 _ = scores // Use the result to prevent optimization
475486
0 commit comments