oertl commented on code in PR #20359:
URL: https://github.com/apache/kafka/pull/20359#discussion_r2444683453


##########
clients/src/test/java/org/apache/kafka/common/utils/UtilsTest.java:
##########
@@ -117,6 +118,35 @@ public void testMurmur2() {
         }
     }
 
+    private static String toHexString(byte[] buf) {
+        StringBuilder bld = new StringBuilder();
+        for (byte b : buf) {
+            bld.append(String.format("%02x", b));
+        }
+        return bld.toString();
+    }
+
+    @Test
+    public void testMurmur2Checksum() {
+        // calculates the checksum of hashes of many different random byte 
arrays of variable length
+        // this test detects any incompatible changes to the Murmur2 
implementation with near certainty
+        int numTrials = 100;
+        int maxLen = 1000;
+        SplittableRandom random = new SplittableRandom(0xbd4458b165652255L);

Review Comment:
   It is my general habit to always select random seed values for unit tests. 
This way, you can assume that they are unique and therefore do not interfere 
with other seeds that may be used elsewhere in the code. However, this is not 
necessary in this particular unit test. If you prefer, I can also change the 
seed to any other value, such as simply 0.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to