CCCLL opened a new pull request, #16531:
URL: https://github.com/apache/dubbo/pull/16531

   ## What is the purpose of the change?
   
   Fixes #16530.
   
   After `cd <service>`, the QoS telnet command `count <method> <times>` read 
the times from `args[2]`, which only exists when the service name is given as 
well. `count sayHello 10` after `cd` therefore printed the statistics once 
instead of ten times.
   
   This PR reads the times from the argument after the method in both forms. 
Without `cd` the parsing is unchanged.
   
   ## Behavior change
   
   - After `cd`, `count <method> <times>` now prints the statistics `<times>` 
times instead of once.
   - After `cd`, a non-numeric second argument (for example `count sayHello x`) 
is now rejected with `Illegal times x, must be integer.`, as it already is 
without `cd`, instead of being ignored. A third argument after `cd` is no 
longer used as the times.
   - Without `cd`, nothing changes.
   
   ## Verification
   
   - New `CountTelnetTest#testCountTimesWithDefaultService` (`count sayHello 2` 
with a default service) fails before the change (only one result is sent) and 
passes after it.
   - Compared the old and new argument parsing for every combination of up to 
four arguments taken from a service name, a method name, a number, a non-number 
and an empty string, with and without a default service: without `cd` the 
result is the same for every input; with `cd` it differs only when the first 
argument is not a number and there are at least two arguments.
   - `mvn verify -pl dubbo-plugin/dubbo-qos`: 108 tests, 0 failures (5 skipped, 
the `@Disabled` `GenericServiceTest`); spotless and checkstyle are clean.
   - End to end, a provider with QoS enabled, commands sent over telnet:
   
   | Commands | before | after |
   |---|---|---|
   | `cd repro.Echo`, `count length 3` | 1 table | 3 tables |
   | `count repro.Echo length 3` | 3 tables | 3 tables |
   | `cd repro.Echo`, `count 3` | 3 tables | 3 tables |
   | `cd repro.Echo`, `count length x` | 1 table | `Illegal times x, must be 
integer.` |
   
   ## Checklist
   - [x] Make sure there is a 
[GitHub_issue](https://github.com/apache/dubbo/issues) field for the change.
   - [x] Write a pull request description that is detailed enough to understand 
what the pull request does, how, and why.
   - [x] Write necessary unit-test to verify your logic correction. If the new 
feature or significant change is committed, please remember to add sample in 
[dubbo samples](https://github.com/apache/dubbo-samples) project.
   - [ ] Make sure gitHub actions can pass. [Why the workflow is failing and 
how to fix it?](../CONTRIBUTING.md)
   


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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to