New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix UT asserts #349
Fix UT asserts #349
Conversation
Change-Id: I3b890a3bdcceb21876b157eda96d066938638387
@fiboknacky I see you changed some UTs in #291, any further context you could provide before I deep dive into the FieldMarks util class by any chance? |
I'm not sure what in particular you would like me to provide more. Could you elaborate? To provide a summary here again, the PR was to fix the wrong behavior of FieldMasks. This makes the PHP lib aligned with the Java lib as well. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Asserts always return true when comparing two FieldMask instances. I switch to a comparison of their JSON string representation instead.
What do you mean by this? Do you mean testFieldMaskCompare
always passed before?
When I assert that two FieldMask instance values are equal, it always returns <?php
// ...
$this->assertEquals($expectedFieldMask, $actualFieldMask); When I change the values to their JSON strings instead, the comparison then returns <?php
// ...
$this->assertEquals(
$expectedFieldMask->serializeToJsonString(),
$actualFieldMask->serializeToJsonString()
); |
What cases that you expected to see it failed but it succeeded?
I think this is a bit not quite correct. We shouldn't depend on how the fields are serialized as string, unless the serializeToJsonString always serialize fields in a deterministic way. |
Change-Id: I84a16cc45d0363448b72aeed94b0713e846b254c
@fiboknacky sorry I forgot to flag the PR as draft, this code is exploratory. I added you as reviewer but I only wanted to gather historical context about these tests. Summary
Details
|
Understood. Please let me know when it's ready for review. |
Quick update: after further investigation the UTs fail due to wrong comparison of repeated fields. I opened the issue haberman/protobuf#13 to confirm. |
The current behavior of repeated field is a bug, fix should come from this protocolbuffers/protobuf#7650. |
I just tested with protocolbuffers/protobuf#7650 and protocolbuffers/protobuf#7900 and it seems to be fixed. Let's wait for the next protobuf release before closing this though. |
I confirm that all the unit tests pass successfully with the new release of |
Asserts always return true when comparing two FieldMask instances. I switch to a comparison of their JSON string representation instead.
KNOWN ISSUE: 2 UTs fail with this new way of assertion, I mark this PR as DRAFT for now until a fix is found.
Change-Id: I3b890a3bdcceb21876b157eda96d066938638387