Commit 3f58381
Fix flaky DuplicateStreamIdThrows tests
Summary:
The DuplicateStreamIdThrows tests in SinkServiceTest and StreamServiceTest
were flaky due to a race condition in the server's connection close flow.
When the server detects a duplicate stream ID, it calls close() which sends
a connection-level error frame and sets the state to CLOSING. However,
closeIfNeeded() won't fully close the connection while there are inflight
requests. The handler for the first (valid) frame can still complete and
send a response before the connection fully closes. If the client receives
this response before the connection-level error frame, co_await completes
successfully instead of throwing TTransportException.
Fixed both tests to handle both race outcomes:
1. If co_await throws TTransportException - pass (duplicate detected before
response arrived)
2. If co_await succeeds - verify the connection is broken by asserting a
follow-up request throws TTransportException
Both outcomes correctly verify the server handles duplicate stream IDs.
Reviewed By: evanjzou
Differential Revision: D94856980
fbshipit-source-id: f8e463d3fcbf319d94c0cb6ff0e8921b1ea8650e1 parent 1ef7083 commit 3f58381
2 files changed
Lines changed: 24 additions & 4 deletions
Lines changed: 12 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
403 | 403 | | |
404 | 404 | | |
405 | 405 | | |
406 | | - | |
407 | | - | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
408 | 418 | | |
409 | 419 | | |
410 | 420 | | |
| |||
Lines changed: 12 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
143 | 143 | | |
144 | 144 | | |
145 | 145 | | |
146 | | - | |
147 | | - | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
148 | 158 | | |
149 | 159 | | |
150 | 160 | | |
| |||
0 commit comments