Refactor testing utilities#56
Merged
aryan-25 merged 16 commits intoswift-server:mainfrom Feb 26, 2026
Merged
Conversation
gjcairo
requested changes
Feb 17, 2026
Tests/NIOHTTPServerTests/Utilities/NIOClient/NIOClient+HTTP1.swift
Outdated
Show resolved
Hide resolved
Tests/NIOHTTPServerTests/Utilities/NIOClient/NIOClient+HTTP1.swift
Outdated
Show resolved
Hide resolved
Tests/NIOHTTPServerTests/Utilities/NIOClient/NIOClient+HTTP1.swift
Outdated
Show resolved
Hide resolved
Tests/NIOHTTPServerTests/Utilities/NIOClient/NIOClient+SecureUpgrade.swift
Outdated
Show resolved
Hide resolved
Tests/NIOHTTPServerTests/Utilities/TestingChannelClientServer/TestingChannelClient+HTTP1.swift
Outdated
Show resolved
Hide resolved
...TTPServerTests/Utilities/TestingChannelClientServer/TestingChannelClient+SecureUpgrade.swift
Outdated
Show resolved
Hide resolved
...TTPServerTests/Utilities/TestingChannelClientServer/TestingChannelClient+SecureUpgrade.swift
Outdated
Show resolved
Hide resolved
…r `Channel` and `ClientBootstrap`
gjcairo
reviewed
Feb 23, 2026
gjcairo
approved these changes
Feb 26, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation:
We currently have two mechanisms for testing
NIOHTTPServerin an end-to-end manner. The first mechanism involves starting upNIOHTTPServeron localhost, and setting up a NIO client (backed by NIO'sClientBootstrap) to send requests / observe responses. The second mechanism involves spoofing aNIOAsyncTestingChannelas the channelNIOHTTPServerruns on, wiring a client channel (also backed by aNIOAsyncTestingChannel) to the server channel, and writing/reading to/from the client channel.Currently, both mechanisms share some duplicated code, have no documentation, and in general are poorly named/structured. We should improve this.
Modifications:
Functionality of the existing
Clienttype broken down into extensions onChannelandClientBootstrap.NIOAsyncTestingChannel-based mechanism.The
NIOAsyncTestingChannel-based mechanism is now structured intoTestingChannelHTTP1ServerandTestingChannelSecureUpgradeServer.Added documentation for all test utilities and some general refactoring.
Result:
Easier to write more involving tests.