kevin-wu24 commented on code in PR #22191:
URL: https://github.com/apache/kafka/pull/22191#discussion_r3290361588
##########
clients/src/test/java/org/apache/kafka/clients/admin/KafkaAdminClientTest.java:
##########
@@ -9933,97 +9937,147 @@ public void
testDescribeReplicaLogDirsWithNonExistReplica() throws Exception {
}
}
+ private static final int UNREGISTER_NODE_ID = 1;
+
+ private static final Function<Errors, AbstractResponse>
BROKER_RESPONSE_FACTORY =
+ error -> new UnregisterBrokerResponse(new
UnregisterBrokerResponseData()
+ .setErrorCode(error.code())
+ .setErrorMessage(error.message()));
+
+ private static final Function<Errors, AbstractResponse>
CONTROLLER_RESPONSE_FACTORY =
+ error -> new UnregisterControllerResponse(new
UnregisterControllerResponseData()
+ .setErrorCode(error.code())
+ .setErrorMessage(error.message()));
+
+ private static final Function<Admin, KafkaFuture<Void>>
UNREGISTER_BROKER_CALL =
+ admin -> admin.unregisterBroker(UNREGISTER_NODE_ID).all();
+
+ private static final Function<Admin, KafkaFuture<Void>>
UNREGISTER_CONTROLLER_CALL =
+ admin -> admin.unregisterController(UNREGISTER_NODE_ID).all();
+
+ private void runUnregisterScenario(
+ AdminClientUnitTestEnv env,
+ ApiKeys apiKey,
+ Function<Errors, AbstractResponse> responseFactory,
+ Function<Admin, KafkaFuture<Void>> adminCall,
+ List<Errors> responsesToPrepare,
+ Class<? extends Throwable> expectedException
+ ) throws ExecutionException, InterruptedException {
Review Comment:
Basically, I just copied the unregister broker tests, but that resulted in
lots of duplicate code.
--
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]