alanlau28 commented on code in PR #23511:
URL: https://github.com/apache/kafka/pull/23511#discussion_r4062586958


##########
generator/src/test/java/org/apache/kafka/message/MessageGeneratorTest.java:
##########
@@ -189,60 +191,90 @@ public void testHeaderVersionExplicitSingleRange() throws 
Exception {
     }
 
     @Test
-    public void testHeaderVersionFallbackFlexibleDerived() throws Exception {
+    public void testHeaderVersionMapIsTheOnlySource() throws Exception {
+        // A map that disagrees with the flexibleVersions-derived rule is 
emitted verbatim: there is no
+        // fallback that could second-guess it. (Parse-time checks against the 
header schemas run in
+        // processDirectories, not here.)
         String source = generateApiMessageTypeSource(
-            spec(3, "request", "QuxRequest", "0-5", "2+", null),
-            spec(3, "response", "QuxResponse", "0-5", "2+", null));
-        assertTrue(source.contains(
-            "case 3: // Qux\n" +
-            "if (_version >= 2) {\n" +
-            "return (short) 2;\n" +
-            "} else {\n" +
-            "return (short) 1;\n" +
-            "}\n"), source);
+            spec(3, "request", "QuxRequest", "0-5", "2+", "{'0+': '1'}"),

Review Comment:
   This was to replace the old test that made sure the absence of 
headerVersions still used flexibleVersions to generate code. This test uses a 
schema with headerVersions that would fail the validation to make sure the code 
still generates when there is a schema with headerVersions. The 
flexibility/header check itself lives in `checkHeaderVersions()`.
   
   Now that i think about it more, this could be unnecessary and I could remove 
it entirely.



-- 
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