FrankYang0529 commented on code in PR #16753:
URL: https://github.com/apache/kafka/pull/16753#discussion_r1705413621


##########
clients/src/test/java/org/apache/kafka/clients/admin/KafkaAdminClientTest.java:
##########
@@ -7811,6 +7816,40 @@ public void testListClientMetricsResourcesNotSupported() 
{
         }
     }
 
+    @Test
+    public void 
testCallFailWithUnsupportedVersionExceptionDoesNotHaveConcurrentModificationException()
 throws InterruptedException {
+        try (AdminClientUnitTestEnv env = new 
AdminClientUnitTestEnv(mockCluster(1, 0))) {
+            AdminMetadataManager metadataManager = 
mock(AdminMetadataManager.class);
+
+            // first false result make sure 
LeastLoadedBrokerOrActiveKController#provide can go to requestUpdate
+            // second true result make sure 
LeastLoadedBrokerOrActiveKController#provide can get a node
+            doReturn(false).doReturn(true).when(metadataManager).isReady();
+
+            // make maybeDrainPendingCall throw UnsupportedVersionException 
and go to Call#fail
+            doThrow(new UnsupportedVersionException("Unsupported 
version")).doNothing().when(metadataManager).requestUpdate();
+
+            // make sure describeCluster handleUnsupportedVersionException 
doesn't always return false
+            doReturn(false).when(metadataManager).usingBootstrapControllers();
+            // avoid sending fetchMetadata request
+            doReturn(1L).when(metadataManager).metadataFetchDelayMs(anyLong());
+
+            env.kafkaClient().setNodeApiVersions(NodeApiVersions.create());
+
+            try (KafkaAdminClient admin = KafkaAdminClient.createInternal(

Review Comment:
   Hi @chia7712, the CI result looks good. I can't reproduce failed cases on my 
laptop.
   
   ```
   ./gradlew cleanTest :streams:test --tests 
ThreadCacheTest.cacheOverheadsSmallValues :tools:test --tests 
GetOffsetShellTest.testTopicPartitionsArg :storage:test --tests 
TransactionsWithTieredStoreTest.testAbortTransactionTimeout :core:test --tests 
ConsumerBounceTest.testConsumptionWithBrokerFailures --tests 
DelegationTokenEndToEndAuthorizationWithOwnerTest.testNoProduceWithDescribeAcl 
--tests 
DelegationTokenEndToEndAuthorizationWithOwnerTest.testCreateTokenForOtherUserFails
 --tests 
MetricsDuringTopicCreationDeletionTest.testMetricsDuringTopicCreateDelete 
--tests 
SaslScramSslEndToEndAuthorizationTest.testNoDescribeProduceOrConsumeWithoutTopicDescribeAcl
 --tests PlaintextConsumerCommitTest.testCommitMetadata --tests 
PlaintextConsumerFetchTest.testLowMaxFetchSizeForRequestAndPartition 
:clients:test --tests 
StickyAssignorTest.testLargeAssignmentAndGroupWithNonEqualSubscription --tests 
StickyAssignorTest.testLargeAssignmentAndGroupWithUniformSubscription
   ```



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