@@ -71,6 +71,7 @@ func TestPrefixPlugin(t *testing.T) {
71
71
},
72
72
}
73
73
plugin .PreRequest (context .Background (), req1 , schedulingResult , 0 )
74
+ plugin .wg .Wait ()
74
75
75
76
// Second request doesn't share any prefix with first one. It should be added to the cache but
76
77
// the pod score should be 0.
@@ -98,6 +99,7 @@ func TestPrefixPlugin(t *testing.T) {
98
99
},
99
100
}
100
101
plugin .PreRequest (context .Background (), req2 , schedulingResult , 0 )
102
+ plugin .wg .Wait ()
101
103
102
104
// Third request shares partial prefix with first one.
103
105
req3 := & types.LLMRequest {
@@ -123,6 +125,7 @@ func TestPrefixPlugin(t *testing.T) {
123
125
},
124
126
}
125
127
plugin .PreRequest (context .Background (), req3 , schedulingResult , 0 )
128
+ plugin .wg .Wait ()
126
129
127
130
// 4th request is same as req3 except the model is different, still no match.
128
131
req4 := & types.LLMRequest {
@@ -148,6 +151,7 @@ func TestPrefixPlugin(t *testing.T) {
148
151
},
149
152
}
150
153
plugin .PreRequest (context .Background (), req4 , schedulingResult , 0 )
154
+ plugin .wg .Wait ()
151
155
152
156
// 5th request shares partial prefix with 3rd one.
153
157
req5 := & types.LLMRequest {
@@ -173,6 +177,7 @@ func TestPrefixPlugin(t *testing.T) {
173
177
},
174
178
}
175
179
plugin .PreRequest (context .Background (), req5 , schedulingResult , 0 )
180
+ plugin .wg .Wait ()
176
181
}
177
182
178
183
// TestPrefixPluginStress is a stress test for the prefix scoring plugin, using prompts of increasing length.
@@ -220,6 +225,7 @@ func BenchmarkPrefixPluginStress(b *testing.B) {
220
225
},
221
226
}
222
227
plugin .PreRequest (context .Background (), req , schedulingResult , 0 )
228
+ plugin .wg .Wait ()
223
229
224
230
// Second cycle: validate internal state
225
231
state , err := plugins .ReadPluginStateKey [* SchedulingContextState ](plugin .pluginState , req .RequestId , plugins .StateKey (plugin .TypedName ().String ()))
0 commit comments