From 1a7a7ed1c301f4ef08ced9c398d320a80f1468f1 Mon Sep 17 00:00:00 2001
From: sebastianas <sebastianas@users.noreply.github.com>
Date: Mon, 25 Nov 2024 21:46:41 +0100
Subject: [PATCH] test: Don't check for the exact size of compressed content.
 (#1984)

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>
---
 test/test.cc | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/test/test.cc b/test/test.cc
index cc9ffeb..d2aa07a 100644
--- a/test/test.cc
+++ b/test/test.cc
@@ -4258,7 +4258,9 @@ 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"));
+  // The compressed size should be less than a 10th of the original. May vary
+  // depending on the zlib library.
+  EXPECT_LT(res.get_request_header_value_u64("Content-Length"),  10 * 1024 * 1024);
   EXPECT_EQ("gzip", res.get_request_header_value("Content-Encoding"));
 }