-
Notifications
You must be signed in to change notification settings - Fork 117
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Address flakiness of testSSLHandshakeErrorPropagation #335
Conversation
70af540
to
4f63e8e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you! LGTM
4f63e8e
to
f121ddf
Compare
Oh hey, fun, a new flaky test! Tracking in #290. |
@swift-server-bot test this please |
@weissi please re-review, I added a new test. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks @Lukasa , looks mostly good to me, just one question around hardcoding 54 for ECONNRESET
if isTestingNIOTS() { | ||
XCTAssertEqual(error as? ChannelError, .connectTimeout(.milliseconds(100))) | ||
} else { | ||
XCTAssertEqual((error as? IOError).map { $0.errnoCode }, 54) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
any reason to use 54
over ECONNRESET
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just cribbed it from the test above, happy to swap it.
Motivation: Flaky tests are bad. This test is flaky because the server closes the connection immediately upon channelActive. In practice this can mean that the handshake never even gets a chance to start: by the time the SSLHandler ends up in the pipeline the connection is already dead. Heck, by the time we attempt to complete the connection the connection might be dead. Modifications: - Change the shutdown to be on first read. - Remove the disabled autoRead. - Change the expected NIOTS failure mode to connectTimeout, which is how this manifests in NIOTS. Result: Test is no longer flaky.
6aef0d0
to
e22d958
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
awesome, thank you!
@swift-server-bot test this please |
One good validation of this having fixed a flaky test is that while we've hit at least two other flaky tests, we've not hit the one this was trying to fix! |
Motivation:
Flaky tests are bad.
This test is flaky because the server closes the connection immediately
upon channelActive. In practice this can mean that the handshake never
even gets a chance to start: by the time the SSLHandler ends up
in the pipeline the connection is already dead. Heck, by the time we
attempt to complete the connection the connection might be dead.
Modifications:
which is how this manifests in NIOTS.
Result:
Test is no longer flaky.