Skip to content

test: pin the WebSocket client shared close deadline - #1654

Open
He-Pin wants to merge 1 commit into
apache:mainfrom
He-Pin:test/ws-client-shared-close-deadline
Open

He-Pin wants to merge 1 commit into
apache:mainfrom
He-Pin:test/ws-client-shared-close-deadline

Conversation

@He-Pin

@He-Pin He-Pin commented Nov 26, 2026

Copy link
Copy Markdown
Member

Motivation

The existing integration test covers a normal WebSocket closing handshake, but its wall-clock window does not pin the deadline shared by the two client closing phases.

Modification

Use the manual scheduler in a native frame output test. Start an ordinary closing handshake, acknowledge it from the peer halfway through the wait, and confirm the client stage has consumed the acknowledgement. Keep the transport open and verify that output completes at the original deadline after sending a single Close frame. No production changes. This is separate from the client timeout coverage in #1642.

Result

The test detects a timeout budget restarted by the acknowledgement, as well as premature completion.

Tests

  • JDK 17: the focused test passed on Scala 2.13.18 and Scala 3.3.9 (1/1 on each).
  • Scoped import organization, formatting, and license-header checks passed.
  • Local mutation checks for restarting the wait and completing 1 ms early both failed as expected.

References

RFC 6455 §5.5.1 and §7.1.1.

Motivation:
The client integration test covers a normal closing handshake, but a
wall-clock window cannot pin the exact deadline across both phases.

Modification:
Exercise the client frame output directly with its manual scheduler.
Wait for the normal outgoing Close, deliver the positive peer reply
halfway through the wait, and observe that the stage has consumed it.
Keep the transport open and check the original deadline, not a new wait.

Result:
The original deadline and one outgoing Close are tested without changing
the existing client integration coverage or production behavior.

Tests:
JDK 17: the focused spec passed on Scala 2.13.18 and 3.3.9.
Scoped import organization, formatting and header checks passed.
The negative controls
observed completion at 99 ms with a shorter deadline, or no completion
at 100 ms if the peer acknowledgement restarted the budget.

References:
RFC 6455 Sections 5.5.1 and 7.1.1, and the distinct single-phase
client timeout coverage in apache#1642.
@He-Pin
He-Pin requested a review from pjfanning November 26, 2026 08:47

@pjfanning pjfanning left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants