jubins opened a new pull request, #29947:
URL: https://github.com/apache/flink/pull/29947

   ## What is the purpose of the change
   
   This PR adds dedicated unit tests for three REST query parameters in 
`flink-runtime` (`org.apache.flink.runtime.rest.messages`): 
`SubtaskIndexQueryParameter`, `FlameGraphTypeQueryParameter` and 
`TerminationModeQueryParameter`. Until now they had no test class of their own, 
and only `JobVertexFlameGraphHandlerTest` and `JobCancellationHandlerTest` 
covered them indirectly. Nothing pinned down their parsing rules: the key name, 
that each one is optional, that a negative subtask index is rejected, that enum 
parsing ignores case, and that values are written back in lower case. The new 
tests follow the existing `ThreadDumpModeQueryParameterTest` and 
`SubtaskIndexPathParameterTest`.
   
   This is a test-only change. No production code is modified.
   
   ## Brief change log
   
     - `SubtaskIndexQueryParameterTest`: checks the key `subtaskindex` and that 
the parameter is optional. It checks that 0, a positive value and 
`Integer.MAX_VALUE` are accepted, that `-1` throws `ConversionException` with 
its message, that a non-numeric value throws `NumberFormatException` (what the 
code currently throws), and that `convertValueToString` returns the decimal 
string.
     - `FlameGraphTypeQueryParameterTest`: checks the key `type` and that the 
parameter is optional. It checks that `full` / `on_cpu` / `off_cpu` parse in 
lower, upper and mixed case, that an unknown value throws 
`IllegalArgumentException`, and that `convertValueToString` returns lower case 
for all three types.
     - `TerminationModeQueryParameterTest`: checks the key `mode` and that the 
parameter is optional. It checks that `cancel` parses in lower, upper and mixed 
case and that the deprecated `stop` still parses. It also checks that an 
unknown value throws `IllegalArgumentException` and that `convertValueToString` 
returns lower case.
   
   ## Verifying this change
   
   Please make sure both new and modified tests in this PR follow [the 
conventions for tests defined in our code quality 
guide](https://flink.apache.org/how-to-contribute/code-style-and-quality-common/#7-testing).
   
   This change added tests and can be verified as follows:
   
     - `./mvnw -pl flink-runtime test 
-Dtest='SubtaskIndexQueryParameterTest,FlameGraphTypeQueryParameterTest,TerminationModeQueryParameterTest'`
 runs 17 tests, and all of them pass on JDK 21.
     - To check that the tests catch real regressions, I temporarily removed 
the negative-index check in `SubtaskIndexQueryParameter` and the 
`toLowerCase()` in `FlameGraphTypeQueryParameter#convertValueToString`. With 
those changes, `rejectsNegativeValueWithConversionException` and 
`convertValueToStringIsLowerCase` failed. I then reverted both changes.
   
   ## Does this pull request potentially affect one of the following parts:
   
     - Dependencies (does it add or upgrade a dependency): no
     - The public API, i.e., is any changed class annotated with 
`@Public(Evolving)`: no
     - The serializers: no
     - The runtime per-record code paths (performance sensitive): no
     - Anything that affects deployment or recovery: JobManager (and its 
components), Checkpointing, Kubernetes/Yarn, ZooKeeper: no
     - The S3 file system connector: no
   
   ## Documentation
   
     - Does this pull request introduce a new feature? no
     - If yes, how is the feature documented? not applicable
   
   ---
   
   ##### Was generative AI tooling used to co-author this PR?
   
   - [X] Yes (please specify the tool below)
   
   Generated-by: Claude Code (Claude Opus 5.5)
   


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

Reply via email to