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


##########
clients/src/test/java/org/apache/kafka/clients/NetworkClientTest.java:
##########
@@ -198,6 +201,59 @@ public void setup() {
             CommonClientConfigs.DEFAULT_RETRY_BACKOFF_MS);
     }
 
+    @Test
+    public void testClientInstanceIdIsSentInTheV3RequestHeader() {
+        Uuid clientInstanceId = Uuid.randomUuid();
+        NetworkClient client = new NetworkClient(metadataUpdater, null, 
selector, "mock", clientInstanceId, Integer.MAX_VALUE,
+                reconnectBackoffMsTest, reconnectBackoffMaxMsTest, 64 * 1024, 
64 * 1024,
+                defaultRequestTimeoutMs, connectionSetupTimeoutMsTest, 
connectionSetupTimeoutMaxMsTest,
+                time, true, new ApiVersions(), null, new LogContext(), new 
DefaultHostResolver(), null,
+                Long.MAX_VALUE, MetadataRecoveryStrategy.NONE, 
BootstrapConfiguration.DISABLED, false);
+        // OffsetDelete v1 uses the v3 request header, while v0 does not.
+        ClientRequest request = client.newClientRequest(node.idString(),
+                new OffsetDeleteRequest.Builder(new 
OffsetDeleteRequestData()), time.milliseconds(), true);
+        assertEquals(clientInstanceId, request.makeHeader((short) 
1).clientInstanceId());
+        assertEquals(Uuid.ZERO_UUID, request.makeHeader((short) 
0).clientInstanceId());
+    }
+
+    @Test
+    public void testClientInstanceIdIsRequired() {
+        assertThrows(NullPointerException.class, () -> new 
NetworkClient(metadataUpdater, null, selector, "mock", null,

Review Comment:
   The key fact here is that the `null` after the `"mock"` is the omitted 
client instance ID. Maybe a comment would make it less hard to figure out what 
the test is actually doing :) 



##########
clients/src/test/java/org/apache/kafka/common/requests/RequestHeaderTest.java:
##########
@@ -60,6 +61,49 @@ public void testRequestHeaderV2() {
         assertEquals(header, deserialized);
     }
 
+    @Test
+    public void testRequestHeaderV3() {

Review Comment:
   This is really `testRequestHeaderV3WithoutClientInstanceId` I think.



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