chenBright commented on code in PR #3691:
URL: https://github.com/apache/brpc/pull/3691#discussion_r4426067752
##########
test/brpc_channel_unittest.cpp:
##########
@@ -2576,6 +2576,25 @@ TEST_F(ChannelTest, init_using_unknown_naming_service) {
ASSERT_EQ(-1, channel.Init("unknown://unknown", "unknown", nullptr));
}
+TEST_F(ChannelTest, selective_channel_invalid_load_balancer) {
+ GFLAGS_NAMESPACE::FlagSaver flag_saver;
+#if !BRPC_WITH_GLOG
+ // Invalid configuration must return an error even when fatal logs abort.
+ ASSERT_FALSE(GFLAGS_NAMESPACE::SetCommandLineOption(
+ "crash_on_fatal_log", "true").empty());
+#endif
Review Comment:
With brpc’s built-in logger, `crash_on_fatal_log` defaults to false.
Without explicitly enabling it, reverting initialization to `LOG(FATAL)` could
still return `-1` and pass the test.
Enabling the flag intentionally guards against that regression, and
`FlagSaver` restores its value afterward. The flag setting and its comment
should remain
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]