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


##########
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 one is interesting. I would have expected, because it's not 
ApiVersions, that Qux would be `{'0-1': '1', '2+': '2'}` and `{'0-1': '0', 
'2+': '1'}`. I wonder what the idea behind this is. btw, the changes look good, 
but I am just wondering the intent here.



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