Skip to content
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

test: Don't check for the exact size of compressed content. #1984

Merged
merged 1 commit into from
Nov 25, 2024

Conversation

sebastianas
Copy link
Contributor

The testsuite checks for the exact size of the compressed content. The exact size can change if the zlib library is using a different strategy. In thise case using zlib-ng results in a slightly larger content leading to a failure in the test.

Check that the compressed content is less than 10MiB which is a tenth of the orignal content and proves that compression works.

test/test.cc Outdated
@@ -4258,7 +4258,7 @@ TEST_F(ServerTest, PutLargeFileWithGzip2) {
ASSERT_TRUE(res);
EXPECT_EQ(StatusCode::OK_200, res->status);
EXPECT_EQ(LARGE_DATA, res->body);
EXPECT_EQ(101942u, res.get_request_header_value_u64("Content-Length"));
EXPECT_TRUE(res.get_request_header_value_u64("Content-Length") < (10 * 1024 * 1024));
Copy link
Contributor

Choose a reason for hiding this comment

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

Instead of EXPECT_TRUE, it'd be better to use EXPECT_LT

Copy link
Owner

Choose a reason for hiding this comment

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

@sebastianas could you also put some comment before EXPECT_LT, so that it clearly explains why this check doesn't use EXPECT_EQ? Thanks!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

both changes have been made.

The testsuite checks for the exact size of the compressed content. The
exact size can change if the zlib library is using a different strategy.
In thise case using zlib-ng results in a slightly larger content leading
to a failure in the test.

Check that the compressed content is less than 10MiB which is a tenth of
the orignal content and proves that compression works.

Signed-off-by: Sebastian Andrzej Siewior <sebastian@breakpoint.cc>
@yhirose yhirose merged commit 1a7a7ed into yhirose:master Nov 25, 2024
4 checks passed
@yhirose
Copy link
Owner

yhirose commented Nov 25, 2024

@sebastianas thanks for your contribution!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants