-
Notifications
You must be signed in to change notification settings - Fork 81
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
Add safe proto diff helper #433
Comments
Actually this isn't specific to adaptive_load, could go in an existing file. |
Actually I don't see an existing file to put it in, will handle this after all these PRs are done. |
This may be clearer than the construct with MessageUtil():
|
Oh that's much nicer indeed |
In the context of this issue, also making a note of a helpful review comment by @mum4k [1]. [1] #522 (comment) |
Interestingly enough, While it is in the public documentation of gtest and gmock, it isn't actually present in the code. So back to plan B. |
Fyi, we now have a proto matcher: nighthawk/test/test_common/proto_matchers.h Lines 40 to 48 in 9a6d718
|
\o/
…On Wed, Aug 18, 2021 at 6:08 PM Jakub Sobon ***@***.***> wrote:
Fyi, we now have a proto matcher:
https://github.com/envoyproxy/nighthawk/blob/9a6d7181ad886d9ad00a769c7d667d07ca2dc5dc/test/test_common/proto_matchers.h#L40-L48
—
You are receiving this because you modified the open/close state.
Reply to this email directly, view it on GitHub
<#433 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ANPRQMN7LU72A6VCY6BKI7LT5QVMZANCNFSM4PTV7OEA>
.
|
In some environments, whitespace differences cause these tests to fail. String matching is less stable than the proto matchers that we now have. Works on #433 Signed-off-by: Nathan Perry <[email protected]>
Fixes #433 Signed-off-by: Nathan Perry <[email protected]>
Need to do this separately after test/adaptive_load/utility.h goes in.
The helper should do:
EXPECT_EQ(message->DebugString(), expected_config.DebugString());
EXPECT_TRUE(Envoy::MessageUtil()(*message, expected_config));
oschaaf:
I learned that with proto3 default values may not get serialised. I'm not 100% sure that equivalence here guarantees actual equivalence with respect to set/not-set/default-value. Therefore, to make sure no edge cases slip past, maybe it makes sense to also double down with MessageUtil()(message1, message1). This won't produce a helpful test message, so I'd put it after comparing the debug strings (which should produce a nice diff), maybe in a helper method.
The text was updated successfully, but these errors were encountered: