(t *testing.T)
| 245 | } |
| 246 | |
| 247 | func TestQuickReorderQueue_Timeout(t *testing.T) { |
| 248 | q := MakeQuickReorderQueue[string](10, 150*time.Millisecond) |
| 249 | defer q.Close() |
| 250 | |
| 251 | q.QueueItem("session1", 1, "item1") |
| 252 | q.QueueItem("session1", 3, "item3") |
| 253 | |
| 254 | time.Sleep(200 * time.Millisecond) |
| 255 | |
| 256 | items := collectItems(q.C(), 2, 100*time.Millisecond) |
| 257 | |
| 258 | if len(items) != 2 { |
| 259 | t.Fatalf("expected 2 items after timeout, got %d", len(items)) |
| 260 | } |
| 261 | if items[0] != "item1" { |
| 262 | t.Errorf("expected item1 first, got %s", items[0]) |
| 263 | } |
| 264 | if items[1] != "item3" { |
| 265 | t.Errorf("expected item3 second (due to timeout), got %s", items[1]) |
| 266 | } |
| 267 | } |
| 268 | |
| 269 | func TestQuickReorderQueue_TimeoutWithLateArrival(t *testing.T) { |
| 270 | q := MakeQuickReorderQueue[string](10, 100*time.Millisecond) |
nothing calls this directly
no test coverage detected