EW-10817 Add HibernationManager unit tests#6732
Conversation
|
That's correct. The After careful review, I believe this is a high-quality PR. The tests are well-structured, well-commented, and the TestFixture additions are properly designed. The intentional leaks and workarounds are clearly documented with TODO references to the bug being tracked. The BUILD.bazel changes are correct. The only potential issue I see is minor: the LGTM |
a07592b to
fd5b913
Compare
jclee
left a comment
There was a problem hiding this comment.
Looks good...
It's great to have unit test coverage for this, thanks! I guess we'd been relying mostly on integration tests for coverage, but of course that makes it very hard to test precise event orderings like this.
fd5b913 to
b966caa
Compare
Merging this PR will improve performance by 14.95%
Performance Changes
Comparing Footnotes
|
Adds a kj_test suite covering normal HibernationManager behavior (basic comm, close, binary, auto-response, multi-IR, multi-WS, hibernation flows, output gate interactions) along with regression tests for EW-10817 that use KJ_EXPECT_LOG to capture the production "another message send is already in progress" assertion. The regression tests pass while the bug exists and fail loudly when the fix lands. Code comments document each test's purpose, lifecycle, and known workarounds. Supporting TestFixture additions: SetupParams::actorLoopback so the actor and the HibernationManager share one Loopback; newIoContext() and newIncomingRequest(IoContext&) for multiple IRs per IoContext; drainAndDestroy() and pollEventLoop() helpers; getActor() and getTimerChannel() accessors so tests can construct the HM outside any IoContext; resetActor() to simulate eviction by reconstructing the Worker::Actor with the same id and Loopback. Two workarounds for known bugs are noted at their use sites: a leaked api::WebSocket ref to dodge the AsyncObject destructor issue, and an explicit end1->receive() drain in some EW-10817 repros to consume the orphaned BlockedSend at teardown. Both go away once EW-10817 is fixed. Assisted-by: OpenCode:claude-opus-4.7
b966caa to
9b82143
Compare
|
Added one new test case in the latest commit. Unfortunately, I failed to push an update between addressing review comments and rebasing on |
Adds a kj_test suite covering normal HibernationManager behavior (basic comm, close, binary, auto-response, multi-IR, multi-WS, hibernation flows, output gate interactions) along with regression tests for EW-10817 that use KJ_EXPECT_LOG to capture the production "another message send is already in progress" assertion. The regression tests pass while the bug exists and fail loudly when the fix lands. Code comments document each test's purpose, lifecycle, and known workarounds.
Supporting TestFixture additions: SetupParams::actorLoopback so the actor and the HibernationManager share one Loopback; newIoContext() and newIncomingRequest(IoContext&) for multiple IRs per IoContext; drainAndDestroy() and pollEventLoop() helpers; getActor() and getTimerChannel() accessors so tests can construct the HM outside any IoContext; resetActor() to simulate eviction by reconstructing the Worker::Actor with the same id and Loopback.
Two workarounds for known bugs are noted at their use sites: a leaked api::WebSocket ref to dodge the AsyncObject destructor issue, and an explicit end1->receive() drain in some EW-10817 repros to consume the orphaned BlockedSend at teardown. Both go away once EW-10817 is fixed.
Assisted-by: OpenCode:claude-opus-4.7