Skip to content

Improve test coverage - #105

Merged
aryan-25 merged 3 commits into
swift-server:mainfrom
aryan-25:improve-test-coverage
Aug 5, 2026
Merged

Improve test coverage#105
aryan-25 merged 3 commits into
swift-server:mainfrom
aryan-25:improve-test-coverage

Conversation

@aryan-25

Copy link
Copy Markdown
Collaborator

Motivation:

All tests currently only test the plaintext or secure upgrade transport. It would be useful to also include the HTTP/3 transport in these tests. Due to the differences in setting up a secure upgrade client compared to an HTTP/3 client, this requires some refactoring to the test utilities.

Modifications:

  • Moved all test helpers from NIOHTTPServerTests to a new TestHelpers type to make accessing the helpers more convenient.
  • Renamed NegotiatedClientConnection to TestClientConnection and extended it to also wrap HTTP/3 connections.
  • Introduced convenience helpers for:
    • Setting up a client connection, or a request channel directly, through with-style helper methods.
    • Creating a server and a matching client configuration for a given transport.
  • Added a test HTTP/3 client.
  • Parameterised tests over HTTPVersion and removed some tests that became redundant as a result.

Result:

Better test coverage.

@aryan-25
aryan-25 requested a review from gjcairo July 30, 2026 15:29
@aryan-25 aryan-25 added the semver/none No version bump required. label Jul 30, 2026
Comment thread Tests/NIOHTTPServerTests/Utilities/NIOClient/NIOClient+HTTP3.swift
Comment thread Tests/NIOHTTPServerTests/Utilities/HTTPVersion.swift
Comment thread Tests/NIOHTTPServerTests/Utilities/TestClientConnection.swift
Comment thread Tests/NIOHTTPServerTests/NIOHTTPServer+ServiceLifecycleTests.swift
Comment thread Tests/NIOHTTPServerTests/Utilities/TestClientConnection.swift Outdated
Comment thread Tests/NIOHTTPServerTests/Utilities/TestClientConnection.swift Outdated
Comment thread Tests/NIOHTTPServerTests/Utilities/Helpers.swift Outdated
@aryan-25
aryan-25 requested a review from gjcairo July 31, 2026 12:25
@aryan-25
aryan-25 merged commit 5c6314b into swift-server:main Aug 5, 2026
17 of 22 checks passed
@aryan-25
aryan-25 deleted the improve-test-coverage branch August 5, 2026 15:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

semver/none No version bump required.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants