wasphin commented on code in PR #3664:
URL: https://github.com/apache/brpc/pull/3664#discussion_r4551756529
##########
test/brpc_builtin_service_unittest.cpp:
##########
@@ -259,7 +259,20 @@ class BuiltinServiceTest : public ::testing::Test{
service.default_method(&cntl, &req, &res, &done);
EXPECT_FALSE(cntl.Failed());
EXPECT_EQ(expect_type, cntl.http_response().content_type());
- CheckContent(cntl, buf);
+ if (brpc::FLAGS_show_hostname_instead_of_ip) {
+ char hostname[256];
Review Comment:
Fixed in 54649569. The expectation now uses the same 128-byte buffer as
NameOfPoint, so hostname resolution and appended-port truncation follow the
same behavior. The updated test translation unit passes a local Clang syntax
check; runtime tests were not rerun locally.
##########
test/brpc_builtin_service_unittest.cpp:
##########
@@ -693,6 +706,13 @@ TEST_F(BuiltinServiceTest, connections) {
TestConnections(true);
}
+TEST_F(BuiltinServiceTest, connections_with_hostnames) {
+ GFLAGS_NAMESPACE::FlagSaver flag_saver;
+ brpc::FLAGS_show_hostname_instead_of_ip = true;
+ TestConnections(false);
+ TestConnections(true);
Review Comment:
Agreed that the loopback-based test is integration coverage for
hostname-enabled output, not deterministic regression coverage for HTML
metacharacters. The existing flags_escaping test already exercises WebEscape
with a payload containing those characters, but does not prove this hostname
call site uses it. For this small rendering change, I prefer to retain that
coverage boundary rather than add a resolver stub or expose a rendering helper
solely for testing. No additional test mechanism is added here.
--
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]