Skip to content

Fix ResponseCompression tests to work with different zlib implementations - #63988

Merged
BrennanConroy merged 4 commits into
dotnet:mainfrom
medhatiwari:fix/responsecompression-system-zlib-compatibility
Oct 31, 2025
Merged

BrennanConroy merged 4 commits into
dotnet:mainfrom
medhatiwari:fix/responsecompression-system-zlib-compatibility

Conversation

@medhatiwari

Copy link
Copy Markdown
Contributor

Fix ResponseCompression tests for system zlib compatibility

Fixes #63969

Changes

  • Replace exact byte count assertions with functional decompression verification in CheckResponseCompressed
  • Add CheckCompressionFunctionality method to verify compression by decompressing content
  • Update HTTPS test methods to use appropriate verification based on compression state
  • Handle edge cases: HEAD requests, NoCompression, and SendFileAsync scenarios

Testing

All existing tests pass with both zlib-ng and system zlib implementations.

cc: @giritrivedi

@github-actions github-actions Bot added the area-middleware Includes: URL rewrite, redirect, response cache/compression, session, and other general middlewares label Oct 10, 2025
@dotnet-policy-service dotnet-policy-service Bot added the community-contribution Indicates that the PR has been added by a community member label Oct 10, 2025
@dotnet-policy-service dotnet-policy-service Bot added the pending-ci-rerun When assigned to a PR indicates that the CI checks should be rerun label Oct 17, 2025
@joperezr

Copy link
Copy Markdown
Member

Thanks a lot for the contribution @medhatiwari! This is a great change and allows us to run our tests against multiple zlib implementations! Ideally we'd want to run the tests in CI against both of those to have coverage and detect regressions but this is a good first step. The tradeoff here of losing brittleness for flexibility feels worth it, especially due to the improvement in correctness coverage.

cc: @BrennanConroy @akoeplinger any other thoughts here or can we go ahead and merge this in?

@BrennanConroy BrennanConroy 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.

The general idea is good.

@giritrivedi

Copy link
Copy Markdown

Can this be merged , if there are no more code changes needed ?

[InlineData(new[] { "identity;q=0.5", "gzip" }, 29)]
public async Task Request_AcceptWithHigherCompressionQuality_Compressed(string[] acceptEncodings, int expectedBodyLength)
{
_ = expectedBodyLength; // Parameter kept for test data compatibility

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.

nit: I don't think we care about preserving the test data from past runs for comparison here. Can just remove this param from where it's needed.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

removed all the unused expectedBodyLength parameters and discard assignments

@BrennanConroy
BrennanConroy merged commit b6a3871 into dotnet:main Oct 31, 2025
@dotnet-policy-service dotnet-policy-service Bot added this to the 11.0-preview1 milestone Oct 31, 2025
akoeplinger pushed a commit that referenced this pull request Oct 21, 2026
…ions (#63988) (#69806)

Co-authored-by: Medha Tiwari <75640645+medhatiwari@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-middleware Includes: URL rewrite, redirect, response cache/compression, session, and other general middlewares community-contribution Indicates that the PR has been added by a community member pending-ci-rerun When assigned to a PR indicates that the CI checks should be rerun

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ResponseCompression tests should verify functionality, not exact compressed byte counts

4 participants