jolshan commented on code in PR #14314: URL: https://github.com/apache/kafka/pull/14314#discussion_r1318833581
########## clients/src/test/java/org/apache/kafka/clients/admin/KafkaAdminClientTest.java: ########## @@ -5633,20 +5643,39 @@ public void testListOffsetsMetadataNonRetriableErrors() throws Exception { node0); final TopicPartition tp1 = new TopicPartition("foo", 0); + final MetadataResponse preparedResponse = prepareMetadataResponse( + cluster, topicMetadataError, partitionMetadataError + ); try (AdminClientUnitTestEnv env = new AdminClientUnitTestEnv(cluster)) { env.kafkaClient().setNodeApiVersions(NodeApiVersions.create()); - env.kafkaClient().prepareResponse(prepareMetadataResponse(cluster, Errors.TOPIC_AUTHORIZATION_FAILED)); + env.kafkaClient().prepareResponse(preparedResponse); Map<TopicPartition, OffsetSpec> partitions = new HashMap<>(); partitions.put(tp1, OffsetSpec.latest()); ListOffsetsResult result = env.adminClient().listOffsets(partitions); - TestUtils.assertFutureError(result.all(), TopicAuthorizationException.class); + TestUtils.assertFutureError(result.all(), expectedFailure); } } + private static Stream<Arguments> listOffsetsMetadataNonRetriableErrors() { + return Stream.of( + Arguments.of( + Errors.TOPIC_AUTHORIZATION_FAILED, + Errors.TOPIC_AUTHORIZATION_FAILED, + TopicAuthorizationException.class + ), + Arguments.of( + // We fail fast when the entire topic is unknown + Errors.UNKNOWN_TOPIC_OR_PARTITION, + Errors.NONE, Review Comment: For my understanding, if the topic also had unknown topic or partition as the partition error message, we would fail fast there too. > With this change, the operation always fails if an error is reported for the entire topic, even if an error is also reported for one or more individual topic partitions. Would we want to add this test case too just so the behavior is also shown in tests? -- 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-unsubscr...@kafka.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org