You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by GitBox <gi...@apache.org> on 2021/10/13 14:35:33 UTC

[GitHub] [kafka] mimaison commented on a change in pull request #11393: MINOR: Refactor RequestResponseTest

mimaison commented on a change in pull request #11393:
URL: https://github.com/apache/kafka/pull/11393#discussion_r728131618



##########
File path: clients/src/test/java/org/apache/kafka/common/requests/RequestResponseTest.java
##########
@@ -251,397 +284,114 @@
     private final UnknownServerException unknownServerException = new UnknownServerException("secret");
 
     @Test
-    public void testSerialization() throws Exception {
-        checkRequest(createControlledShutdownRequest(), true);
-        checkResponse(createControlledShutdownResponse(), 1, true);
-        checkErrorResponse(createControlledShutdownRequest(), unknownServerException, true);
-        checkErrorResponse(createControlledShutdownRequest(0), unknownServerException, true);
-        checkRequest(createFetchRequest(4), true);
-        checkResponse(createFetchResponse(true), 4, true);
-        List<TopicPartition> toForgetTopics = new ArrayList<>();
-        toForgetTopics.add(new TopicPartition("foo", 0));
-        toForgetTopics.add(new TopicPartition("foo", 2));
-        toForgetTopics.add(new TopicPartition("bar", 0));
-        checkRequest(createFetchRequest(7, new FetchMetadata(123, 456), toForgetTopics), true);
-        checkResponse(createFetchResponse(123), 7, true);
-        checkResponse(createFetchResponse(Errors.FETCH_SESSION_ID_NOT_FOUND, 123), 7, true);
-        checkErrorResponse(createFetchRequest(7), unknownServerException, true);
-        checkRequest(createHeartBeatRequest(), true);
-        checkErrorResponse(createHeartBeatRequest(), unknownServerException, true);
-        checkResponse(createHeartBeatResponse(), 0, true);
-
-        for (short version : JOIN_GROUP.allVersions()) {
-            checkRequest(createJoinGroupRequest(version), true);
-            checkErrorResponse(createJoinGroupRequest(version), unknownServerException, true);
-            checkResponse(createJoinGroupResponse(version), version, true);
-        }
-
-        for (short version : SYNC_GROUP.allVersions()) {
-            checkRequest(createSyncGroupRequest(version), true);
-            checkErrorResponse(createSyncGroupRequest(version), unknownServerException, true);
-            checkResponse(createSyncGroupResponse(version), version, true);
-        }
-
-        checkRequest(createLeaveGroupRequest(), true);
-        checkErrorResponse(createLeaveGroupRequest(), unknownServerException, true);
-        checkResponse(createLeaveGroupResponse(), 0, true);
-
-        for (short version : ApiKeys.LIST_GROUPS.allVersions()) {
-            checkRequest(createListGroupsRequest(version), false);
-            checkErrorResponse(createListGroupsRequest(version), unknownServerException, true);
-            checkResponse(createListGroupsResponse(version), version, true);
+    public void testSerialization() {
+        Map<ApiKeys, List<Short>> toSkip = new HashMap<>();
+        // It's not possible to create a MetadataRequest v0 via the builder
+        toSkip.put(METADATA, singletonList((short) 0));
+        // DescribeLogDirsResponse does not have a top level error field
+        toSkip.put(DESCRIBE_LOG_DIRS, DESCRIBE_LOG_DIRS.allVersions());
+        // ElectLeaders v0 does not have a top level error field, when accessing it, it defaults to NONE

Review comment:
       I remember a discussion about whether `errorCounts()` should include the top level error when there are resources. I'm not sure if we reached a conclusion.




-- 
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: jira-unsubscribe@kafka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org