ijuma commented on pull request #10584:
URL: https://github.com/apache/kafka/pull/10584#issuecomment-861498743


   @jolshan The test needs to be adjusted for 2.8. Can you please look into 
that? I started on it, but it also needs to handle the fact that an exception 
is thrown from the handleTopicMetadata method:
   
   ```scala
     @Test
     def testInvalidMetadataRequestReturnsError(): Unit = {
       // Construct invalid MetadataRequestTopics. We will try each one 
separately and ensure the error is thrown.
       val topics = List(new 
MetadataRequestData.MetadataRequestTopic().setName(null).setTopicId(Uuid.randomUuid()),
         new MetadataRequestData.MetadataRequestTopic().setName(null),
         new 
MetadataRequestData.MetadataRequestTopic().setTopicId(Uuid.randomUuid()),
         new 
MetadataRequestData.MetadataRequestTopic().setName("topic1").setTopicId(Uuid.randomUuid()))
   
       // if version is 10 or 11, the invalid topic metadata should return an 
error
       val invalidVersions = Set(10, 11)
       invalidVersions.foreach( version =>
         topics.foreach(topic => {
           val metadataRequestData = new 
MetadataRequestData().setTopics(Collections.singletonList(topic))
           val metadataRequest = new MetadataRequest(metadataRequestData, 
version.toShort)
           val request = buildRequest(metadataRequest)
           val capturedResponse = expectNoThrottling()
           EasyMock.replay(replicaManager, clientRequestQuotaManager,
             autoTopicCreationManager, forwardingManager, 
clientControllerQuotaManager, groupCoordinator, txnCoordinator)
           createKafkaApis().handleTopicMetadataRequest(request)
   
           val response = readResponse(metadataRequest, capturedResponse)
             .asInstanceOf[MetadataResponse]
           assertEquals(1, response.topicMetadata.size)
           assertEquals(1, response.errorCounts.get(Errors.INVALID_REQUEST))
           response.data.topics.forEach(topic => assertNotEquals(null, 
topic.name))
           reset(requestChannel)
         })
       )
     }
   ```


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

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


Reply via email to