RUM-1930 Add regression test for Gson toString method#1742
Merged
mariusc83 merged 1 commit intoNov 23, 2023
Conversation
mariusc83
force-pushed
the
mconstantin/rum-1930/remove-dot-attributest-in-events
branch
from
November 23, 2023 07:40
4212a4a to
b7da33f
Compare
mariusc83
marked this pull request as ready for review
November 23, 2023 07:43
0xnm
approved these changes
Nov 23, 2023
| fun `M add the properties in order in the string W toString()`(forge:Forge){ | ||
| val propertiesKeysValues = forge.aMap(size = forge.anInt(min=5,max=50)){ | ||
| val key = forge.aList(size = forge.anInt(min = 1, max = 10)) { | ||
| anAlphabeticalString() }.joinToString(".") |
Member
There was a problem hiding this comment.
Do we need to have dots in keys? We simply test that keys are added in order, we don't care about keys format.
Member
Author
There was a problem hiding this comment.
yes but I wanted to just make sure it is robust enough. It doesn't hurt to have the dots there.
| * `toString` representation in the order they were added in the JSON object. | ||
| */ | ||
|
|
||
| @Extensions(ExtendWith(ForgeExtension::class), ) |
Member
There was a problem hiding this comment.
Suggested change
| @Extensions(ExtendWith(ForgeExtension::class), ) | |
| @Extensions(ExtendWith(ForgeExtension::class)) |
mariusc83
force-pushed
the
mconstantin/rum-1930/remove-dot-attributest-in-events
branch
from
November 23, 2023 08:28
b7da33f to
3324639
Compare
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## develop #1742 +/- ##
===========================================
- Coverage 83.58% 83.31% -0.27%
===========================================
Files 465 465
Lines 16182 16182
Branches 2412 2412
===========================================
- Hits 13525 13482 -43
- Misses 2016 2039 +23
- Partials 641 661 +20 |
jonathanmos
approved these changes
Nov 23, 2023
| append("{") | ||
| propertiesKeysValues.entries.forEachIndexed { index, entry -> | ||
| when (entry.value) { | ||
| is Int -> append("\"${entry.key}\":${entry.value}") |
Member
There was a problem hiding this comment.
Since Int and Boolean look like they have the same logic, would it make sense to do
Suggested change
| is Int -> append("\"${entry.key}\":${entry.value}") | |
| is Int, is Boolean -> append("\"${entry.key}\":${entry.value}") |
to avoid duplication?
mariusc83
force-pushed
the
mconstantin/rum-1930/remove-dot-attributest-in-events
branch
from
November 23, 2023 09:24
3324639 to
e5e7b69
Compare
mariusc83
deleted the
mconstantin/rum-1930/remove-dot-attributest-in-events
branch
November 23, 2023 09:57
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.
What does this PR do?
As a followup on the previous action taken on iOS: https://datadoghq.atlassian.net/browse/RUM-1929, I investigated all the potential issues on our end regarding this topic and came to the following conclusions:
.attributes on our end but most of them are correctly handled in our serializers.Gsonversion which changes the implementation in adding the properties into thetoStringmethod. Right now they are using aLinkedListwhich suites us very well.In this PR I added a regression test for our Gson dependency to make sure it will always add the properties in the order they were added in the Json object when using the
toStringmethod.Motivation
What inspired you to submit this pull request?
Additional Notes
Anything else we should know when reviewing?
Review checklist (to be filled by reviewers)