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


##########
tools/src/test/java/org/apache/kafka/tools/DelegationTokenCommandTest.java:
##########
@@ -109,4 +110,142 @@ private 
DelegationTokenCommand.DelegationTokenCommandOptions getExpireOpts(Strin
         String[] args = {"--bootstrap-server", "localhost:9092", 
"--command-config", "testfile", "--expire", "--expiry-time-period", "-1", 
"--hmac", hmac};
         return new DelegationTokenCommand.DelegationTokenCommandOptions(args);
     }
+
+    @Test
+    public void testCheckArgsCreateOperation() {
+        String[] args = {"--bootstrap-server", "localhost:9092", 
"--command-config", "testfile", "--create", "--max-life-time-period", 
"604800000"};
+        DelegationTokenCommand.DelegationTokenCommandOptions opts = new 
DelegationTokenCommand.DelegationTokenCommandOptions(args);
+        
+        opts.checkArgs();
+    }
+
+    @Test
+    public void testCheckArgsRenewOperation() {
+        String[] args = {"--bootstrap-server", "localhost:9092", 
"--command-config", "testfile", "--renew", "--hmac", "test-hmac", 
"--renew-time-period", "604800000"};
+        DelegationTokenCommand.DelegationTokenCommandOptions opts = new 
DelegationTokenCommand.DelegationTokenCommandOptions(args);
+        
+        opts.checkArgs();
+    }
+
+    @Test
+    public void testCheckArgsExpireOperation() {
+        String[] args = {"--bootstrap-server", "localhost:9092", 
"--command-config", "testfile", "--expire", "--hmac", "test-hmac", 
"--expiry-time-period", "604800000"};
+        DelegationTokenCommand.DelegationTokenCommandOptions opts = new 
DelegationTokenCommand.DelegationTokenCommandOptions(args);
+        
+        opts.checkArgs();
+    }
+
+    @Test
+    public void testCheckArgsDescribeOperation() {
+        String[] args = {"--bootstrap-server", "localhost:9092", 
"--command-config", "testfile", "--describe"};
+        DelegationTokenCommand.DelegationTokenCommandOptions opts = new 
DelegationTokenCommand.DelegationTokenCommandOptions(args);
+        
+        opts.checkArgs();
+    }
+
+    @Test
+    public void testCheckArgsInvalidArgsForCreate() {
+        String[] args = {"--bootstrap-server", "localhost:9092", 
"--command-config", "testfile", "--create", "--max-life-time-period", 
"604800000", "--hmac", "test-hmac"};
+        DelegationTokenCommand.DelegationTokenCommandOptions opts = new 
DelegationTokenCommand.DelegationTokenCommandOptions(args);

Review Comment:
   For `--create` command, `--renew-time-period` and `--expiry-time-period` are 
invalid arguments as well. Could you also add them to the case? We also need 
similar update for different commands.



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