Mmuzaf commented on code in PR #2497: URL: https://github.com/apache/cassandra/pull/2497#discussion_r2204548081
########## test/unit/org/apache/cassandra/tools/nodetool/SetGetStreamThroughputTest.java: ########## @@ -179,9 +182,9 @@ private static void assertSetInvalidThroughputMbit(String throughput) private static void assertSetGetMoreFlagsIsInvalid() { - ToolResult tool = invokeNodetool("setstreamthroughput", "-m", "5", "-e", "5"); + ToolResult tool = invokeNodetool("setstreamthroughput", "-m", "5", "-e", "6"); assertThat(tool.getExitCode()).isEqualTo(1); - assertThat(tool.getStdout()).contains("You cannot use -e and -m at the same time"); + assertThat(tool.getStdout()).contains("nodetool: Unmatched argument at index 8: '6'"); Review Comment: This is an expected case of invalid input validation due to the framework transition, and the same is true for all similar cases. The validation process has shifted to the Parser stage, where argument types, order, and coexistence of arguments are determined by annotations. This is now more generic. The previous approach with the airline library assumed that the command itself would validate all arguments within the command body, and therefore the validation differs from one command to another. In this particular case, with and an invalid input: `"setstreamthroughput", "-m", "5", "-e", "6"`. The expected type for options `m` and `e` is `boolean`, which isn't recognized by the airline and is passed to the command, in the command body, we validate that the options can coexist at the same time. The `Unmatched argument at index:` error is the Picocli library's default behavior. We can override it, however, using the `@Unmatched` annotation and setting `setUnmatchedArgumentsAllowed` to `true` (the default is `false`) to print our own message. However, I wouldn't do that unless it was absolutely necessary, since the "clarity" doesn't outweigh the drawbacks in this case. -- 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: pr-unsubscr...@cassandra.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: pr-unsubscr...@cassandra.apache.org For additional commands, e-mail: pr-h...@cassandra.apache.org