Skip to content

stabilize tests on Windows - #73

Open
sebastian-carpenter wants to merge 1 commit into
wolfSSL:masterfrom
sebastian-carpenter:stblz-win
Open

sebastian-carpenter wants to merge 1 commit into
wolfSSL:masterfrom
sebastian-carpenter:stblz-win

Conversation

@sebastian-carpenter

Copy link
Copy Markdown
Contributor

Write-timeout tests: skip only the over-delivery check on Windows

TestReadAfterWriteTimeoutSendsNothing, TestLargeWriteTimeoutReportsDeliveredBytes, and TestWriteTimeoutKeepsStreamConsistent now call skipExactWriteCountOnWindows just before their final "nothing arrived beyond the reported bytes" assertion.

On Windows a write deadline cancels the in-flight overlapped WSASend, and Go reports 0, ErrDeadlineExceeded even when the kernel already sent the buffer. This check is undefined behavior on Windows.

All earlier assertions still run on Windows:

  • the timeout surfaces as a net.Error
  • a later Write fails again with n == 0
  • the read side keeps working
  • the peer receives exactly the reported bytes as a prefix

TestIdleCloseWithoutDeadlinesSendsCloseNotify: drain before Close

The client now reads the server's post-handshake messages before closing. Closing a socket that still holds unread data sends a RST. Linux still delivers data the peer has already received ahead of that RST, but Windows discards it, so the peer saw WSAECONNRESET instead of the close_notify.

drainPostHandshake helper

Broke this out into a helper to reduce duplication.

Testing

Linux && Windows pass. Ran go test -count=1 . ./handles ./sha256 ./wolftls ./wolfx509 on both OS's.

@sebastian-carpenter sebastian-carpenter self-assigned this Nov 13, 2026
Copilot AI balanced review requested due to automatic review settings November 13, 2026 21:41

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟢 Approval recommended

There are no active review issues for the Windows TLS connection lifecycle test changes.

No open issues 🎉

What changed in this PR

This PR stabilizes TLS connection lifecycle tests on Windows without changing production code.

Changes:

  • Skips final over-delivery assertions on Windows while preserving earlier timeout and stream-prefix checks.
  • Drains post-handshake data before testing idle close, avoiding resets caused by unread data.
  • Consolidates repeated draining logic into a shared helper with a bounded wait.
File Description
wolftls/​conn_lifecycle_test.go Adjusts Windows timeout assertions and shares post-handshake draining logic across lifecycle tests.

Review effort: Balanced

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.

3 participants