[release/8.0] Fix ResponseCompressionMiddleware tests#60884
[release/8.0] Fix ResponseCompressionMiddleware tests#60884wtgodbe wants to merge 4 commits intorelease/8.0from
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR updates the ResponseCompressionMiddleware tests to account for Fedora41's variable compression sizes by checking that the body length is within a reasonable range.
- Modified test to use an in-range assertion for ContentLength
- Retains the original equality assertion which may lead to conflicting behavior
Comments suppressed due to low confidence (1)
src/Middleware/ResponseCompression/test/ResponseCompressionMiddlewareTest.cs:1327
- The equality assertion conflicts with the new in-range assertion. Consider removing or updating this equality check to avoid failure on Fedora41 where the compression size may vary.
Assert.Equal(expectedBodyLength, response.Content.Headers.ContentLength);
|
Hi @wtgodbe. If this is not a tell-mode PR, please make sure to follow the instructions laid out in the servicing process document. |
src/Middleware/ResponseCompression/test/ResponseCompressionMiddlewareTest.cs
Outdated
Show resolved
Hide resolved
|
Looks like this PR hasn't been active for some time and the codebase could have been changed in the meantime. |
| Assert.Empty(response.Content.Headers.ContentEncoding); | ||
| Assert.Equal(expectedBodyLength, response.Content.Headers.ContentLength); | ||
| // Check that compressed size is within a reasonable range | ||
| Assert.InRange(response.Content.Headers.ContentLength, (int)(expectedBodyLength! - 5), (int)(expectedBodyLength! + 5)); |
There was a problem hiding this comment.
| Assert.InRange(response.Content.Headers.ContentLength, (int)(expectedBodyLength! - 5), (int)(expectedBodyLength! + 5)); | |
| Assert.InRange(response.Content.Headers.ContentLength, (int)(expectedBodyLength.Value - 5), (int)(expectedBodyLength.Value + 5)); |
Compression size is no longer guaranteed on Fedora41, so instead check that the size is within a reasonable range (+/- 5)
Fixes #59870