Given tests: order arrivals by limiter state instead of sleeps (limiter, spread, cancel-while-queued)
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
@@ -70,9 +70,9 @@ func TestDifferentConversationsSpreadByFreeSlots(t *testing.T) {
|
||||
for i := 1; i <= 2; i++ {
|
||||
wg.Add(1)
|
||||
go func(i int) { defer wg.Done(); drain(r.post("/r/v1/chat/completions", conversation(i, 1))) }(i)
|
||||
time.Sleep(50 * time.Millisecond) // arrive one after the other so both pick beta (10 > 2)
|
||||
// arrive one after the other so both pick beta (10 > 2): wait until beta holds i slots
|
||||
waitUntil(t, func() bool { return r.lim.InFlight("beta", "shared") == i })
|
||||
}
|
||||
time.Sleep(50 * time.Millisecond)
|
||||
// …so a third conversation starting now is sent to alpha (beta has 0 free slots, alpha 2).
|
||||
resp := r.post("/r/v1/chat/completions", conversation(3, 1))
|
||||
drain(resp)
|
||||
|
||||
Reference in New Issue
Block a user