MCPcopy Create free account
hub / github.com/apache/brpc / TestRetryOtherServer

Method TestRetryOtherServer

test/brpc_channel_unittest.cpp:2013–2041  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2011 }
2012
2013 void TestRetryOtherServer(bool async, bool short_connection) {
2014 ASSERT_EQ(0, StartAccept(_ep));
2015
2016 brpc::Channel channel;
2017 brpc::ChannelOptions opt;
2018 opt.timeout_ms = 1000;
2019 if (short_connection) {
2020 opt.connection_type = brpc::CONNECTION_TYPE_SHORT;
2021 }
2022 butil::TempFile server_list;
2023 EXPECT_EQ(0, server_list.save_format(
2024 "127.0.0.1:100\n"
2025 "127.0.0.1:200\n"
2026 "%s", endpoint2str(_ep).c_str()));
2027 std::string naming_url = std::string("fIle://")
2028 + server_list.fname();
2029 EXPECT_EQ(0, channel.Init(naming_url.c_str(), "RR", &opt));
2030
2031 const int RETRY_NUM = 3;
2032 test::EchoRequest req;
2033 test::EchoResponse res;
2034 brpc::Controller cntl;
2035 req.set_message(__FUNCTION__);
2036 cntl.set_max_retry(RETRY_NUM);
2037 CallMethod(&channel, &cntl, &req, &res, async);
2038
2039 EXPECT_EQ(0, cntl.ErrorCode()) << async << ", " << short_connection;
2040 StopAndJoin();
2041 }
2042
2043 struct TestRetryBackoffInfo {
2044 TestRetryBackoffInfo(ChannelTest* channel_test_param,

Callers

nothing calls this directly

Calls 7

endpoint2strFunction · 0.85
save_formatMethod · 0.80
fnameMethod · 0.80
set_max_retryMethod · 0.80
ErrorCodeMethod · 0.80
c_strMethod · 0.45
InitMethod · 0.45

Tested by

no test coverage detected