0.2.68
This commit is contained in:
@@ -141,3 +141,17 @@ func TestQueueOrderIsTotalAndStable(t *testing.T) {
|
||||
t.Fatalf("claimed %q; more recent demand should win a tie", candidate.ItemID)
|
||||
}
|
||||
}
|
||||
|
||||
func TestReducingQueueLimitKeepsTheStrongestCandidates(t *testing.T) {
|
||||
queue := NewQueue(5)
|
||||
queue.Push(queued("weak", PrioritySpeculative))
|
||||
queue.Push(queued("ahead", PriorityAhead2))
|
||||
queue.Push(queued("next", PriorityNext))
|
||||
|
||||
queue.SetLimit(2)
|
||||
|
||||
pending := queue.Snapshot()
|
||||
if len(pending) != 2 || pending[0].ItemID != "next" || pending[1].ItemID != "ahead" {
|
||||
t.Fatalf("reduced queue = %+v; want the two strongest candidates", pending)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user