Commit 79d0f866 authored by gejun's avatar gejun

Fix an issue on HC timing in UT

parent 7abe1fd6
...@@ -20,6 +20,8 @@ ...@@ -20,6 +20,8 @@
namespace brpc { namespace brpc {
DECLARE_int32(health_check_interval);
namespace policy { namespace policy {
DECLARE_bool(consul_enable_degrade_to_file_naming_service); DECLARE_bool(consul_enable_degrade_to_file_naming_service);
...@@ -357,6 +359,8 @@ public: ...@@ -357,6 +359,8 @@ public:
TEST(NamingServiceTest, consul_with_backup_file) { TEST(NamingServiceTest, consul_with_backup_file) {
brpc::policy::FLAGS_consul_enable_degrade_to_file_naming_service = true; brpc::policy::FLAGS_consul_enable_degrade_to_file_naming_service = true;
const int saved_hc_interval = brpc::FLAGS_health_check_interval;
brpc::FLAGS_health_check_interval = 1;
const char *address_list[] = { const char *address_list[] = {
"10.127.0.1:1234", "10.127.0.1:1234",
"10.128.0.1:1234", "10.128.0.1:1234",
...@@ -412,6 +416,7 @@ TEST(NamingServiceTest, consul_with_backup_file) { ...@@ -412,6 +416,7 @@ TEST(NamingServiceTest, consul_with_backup_file) {
for (size_t i = 0; i < expected_servers.size(); ++i) { for (size_t i = 0; i < expected_servers.size(); ++i) {
ASSERT_EQ(expected_servers[i], servers[i]); ASSERT_EQ(expected_servers[i], servers[i]);
} }
brpc::FLAGS_health_check_interval = saved_hc_interval;
} }
} //namespace } //namespace
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment