QP001: Burst 10K small tasks via receiveTextChunk, then drain. Memory (queue depth) is observable indirectly via worker-idle latency.
| 38 | // QP001: Burst 10K small tasks via receiveTextChunk, then drain. Memory |
| 39 | // (queue depth) is observable indirectly via worker-idle latency. |
| 40 | TEST_F(QueuePressureTest, QP001_BurstReceive10K_DrainsCleanly) { |
| 41 | ::agenui::testing::ScopedSurfaceManager sm; |
| 42 | constexpr int N = 10000; |
| 43 | auto begin = std::chrono::steady_clock::now(); |
| 44 | sm->beginTextStream(); |
| 45 | for (int i = 0; i < N; ++i) { |
| 46 | sm->receiveTextChunk("x"); |
| 47 | } |
| 48 | sm->endTextStream(); |
| 49 | ASSERT_TRUE(::agenui::testing::WaitForWorkerIdle(30000)); |
| 50 | auto elapsed = std::chrono::duration_cast<std::chrono::milliseconds>( |
| 51 | std::chrono::steady_clock::now() - begin).count(); |
| 52 | // No hard latency contract; just sanity bound to catch infinite loops. |
| 53 | EXPECT_LT(elapsed, 30000) << "elapsed ms=" << elapsed; |
| 54 | } |
| 55 | |
| 56 | // QP002: Burst then immediately destroy. All queued tasks hold a shared_ptr |
| 57 | // to the SM via lambda capture. Destroy enqueues uninit; queue must drain |
nothing calls this directly
no test coverage detected