MINOR: Move RequestConvertToJsonTest to server module - #22988
Merged
Conversation
chia7712
reviewed
Aug 20, 2026
| int messageConversionsTimeMs = 9; | ||
|
|
||
| ObjectNode expectedNode = (ObjectNode) RequestConvertToJson.requestDesc(req.header(), req.requestLog(), req.isForwarded()); | ||
| expectedNode.set("response", res.responseLog().orElse(NullNode.getInstance())); |
Member
There was a problem hiding this comment.
I prefer to verify the fields one-by-one instead of creating a whole JSON object. It looks a bit like a copy-paste from production code😆
assertEquals(false, actualNode.get("isForwarded").asBoolean());
assertEquals("connection-id", actualNode.get("connection").asText());
assertEquals(1.0, actualNode.get("totalTimeMs").asDouble());
assertEquals(2.0, actualNode.get("requestQueueTimeMs").asDouble());
assertEquals(3.0, actualNode.get("localTimeMs").asDouble());
assertEquals(4.0, actualNode.get("remoteTimeMs").asDouble());| expectedNode.set("principal", new TextNode(req.session().principal.toString())); | ||
| expectedNode.set("listener", new TextNode(req.context().listenerName.value())); | ||
| expectedNode.set("clientInformation", RequestConvertToJson.clientInfoNode(req.context().clientInformation)); | ||
| expectedNode.set("temporaryMemoryBytes", new LongNode(temporaryMemoryBytes)); |
Member
There was a problem hiding this comment.
We could have a follow-up to include a test for the following behavior
if (temporaryMemoryBytes > 0) {
node.set("temporaryMemoryBytes", new LongNode(temporaryMemoryBytes));
}
if (messageConversionsTimeMs > 0) {
node.set("messageConversionsTime", new DoubleNode(messageConversionsTimeMs));
}
chia7712
pushed a commit
that referenced
this pull request
Aug 23, 2026
…#23218) This patch addresses the follow-up comments on RequestConvertToJsonTest #22988 (review). Make RequestConvertToJsonTest verify fields individually and add coverage for omitting temporaryMemoryBytes and messageConversionsTime when their values are zero or negative. Reviewers: Uros (github:uros-b), Chia-Ping Tsai <chia7712@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In
18340c9
we only moved part of this class as some tests still depended on core
classes.
We can now move the remaining of the tests and delete the old Scala
file.
Reviewers: Ken Huang s7133700@gmail.com, Luke Chen showuon@gmail.com