chia7712 commented on code in PR #15745:
URL: https://github.com/apache/kafka/pull/15745#discussion_r1582250475


##########
core/src/test/java/kafka/test/ClusterConfig.java:
##########
@@ -55,14 +56,15 @@ public class ClusterConfig {
     private final Map<Integer, Map<String, String>> 
perBrokerOverrideProperties;
 
     @SuppressWarnings("checkstyle:ParameterNumber")
-    private ClusterConfig(Type type, int brokers, int controllers, String 
name, boolean autoStart,
+    private ClusterConfig(Type type, int brokers, int controllers, int 
disksPerBroker, String name, boolean autoStart,
                   SecurityProtocol securityProtocol, String listenerName, File 
trustStoreFile,
                   MetadataVersion metadataVersion, Map<String, String> 
serverProperties, Map<String, String> producerProperties,
                   Map<String, String> consumerProperties, Map<String, String> 
adminClientProperties, Map<String, String> saslServerProperties,
                   Map<String, String> saslClientProperties, Map<Integer, 
Map<String, String>> perBrokerOverrideProperties) {
         this.type = Objects.requireNonNull(type);
         this.brokers = brokers;
         this.controllers = controllers;
+        this.disksPerBroker = disksPerBroker;

Review Comment:
   Could you add check to make sure the value is larger than zero?



##########
core/src/test/java/kafka/test/ClusterTestExtensionsTest.java:
##########
@@ -121,6 +124,26 @@ public void testClusterTests() {
         }
     }
 
+    @ClusterTests({
+        @ClusterTest(clusterType = Type.ZK, disksPerBroker = 1),

Review Comment:
   We can't use `disksPerBroker = 1` since it is equal to the default value.



##########
core/src/test/java/kafka/test/ClusterConfig.java:
##########
@@ -160,6 +166,7 @@ public boolean equals(Object object) {
         return Objects.equals(type, clusterConfig.type)
                 && Objects.equals(brokers, clusterConfig.brokers)
                 && Objects.equals(controllers, clusterConfig.controllers)
+                && Objects.equals(disksPerBroker, clusterConfig.disksPerBroker)

Review Comment:
   not sure whether we need to keep `hashCode` and `equals`. We don't use it 
actually and it is error-prone when adding new fields. For example, this PR 
does not update `hashCode` for the new field. @brandboat WDTY?



##########
core/src/test/java/kafka/test/junit/ClusterTestExtensions.java:
##########
@@ -162,32 +162,39 @@ private void processClusterTest(ExtensionContext context, 
ClusterTest annot, Clu
             controllers = annot.controllers();
         }
 
-        if (brokers <= 0 || controllers <= 0) {
-            throw new IllegalArgumentException("Number of brokers/controllers 
must be greater than zero.");
+        final int disksPerBroker;
+        if (annot.disksPerBroker() == 0) {
+            disksPerBroker = defaults.disksPerBroker();

Review Comment:
   Could we leverage the builder instead of creating a bunch of temporary local 
variables?



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

Reply via email to