Skip to content

Commit

Permalink
Added tolerance to make the test last Netty defaults changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Karm committed Jun 4, 2024
1 parent 223f099 commit e534a94
Showing 1 changed file with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@

public class Testflow {

// Depending on the defaults of the compression algorithm,
// the compressed content length may vary slightly between
// Vert.x/Netty versions over time.
public static final int COMPRESSION_TOLERANCE_BYTES = 2;

/**
* This test logic is shared by both "all" module and "some" module.
* See their RESTEndpointsTest classes.
Expand Down Expand Up @@ -80,8 +85,11 @@ public static void runTest(String endpoint, String acceptEncoding, String conten

final int receivedLength = parseInt(response.headers().get("content-length"));
final int expectedLength = parseInt(contentLength);
assertTrue(receivedLength <= expectedLength,
"Compression apparently failed: receivedLength: " + receivedLength + ", expectedLength: " + expectedLength);

assertTrue(receivedLength <= expectedLength + COMPRESSION_TOLERANCE_BYTES,
"Compression apparently failed: receivedLength: " + receivedLength +
" was supposed to be less or equal to expectedLength: " +
expectedLength + COMPRESSION_TOLERANCE_BYTES);

final String body;
if (actualEncoding != null && !"identity".equalsIgnoreCase(actualEncoding)) {
Expand Down

0 comments on commit e534a94

Please sign in to comment.