mirror of
https://github.com/vale981/ray
synced 2025-03-05 18:11:42 -05:00
[deflakey] Deflakey gcs_heartbeat_manager_test (#28142)
The heartbeat check is every seconds, so it could happen < 1s, which means it could happen very soon. This PR decrease the check period.
This commit is contained in:
parent
ffe12a5f10
commit
4bff702e7b
1 changed files with 10 additions and 10 deletions
|
@ -29,8 +29,8 @@ class GcsHeartbeatManagerTest : public ::testing::Test {
|
||||||
RayConfig::instance().initialize(
|
RayConfig::instance().initialize(
|
||||||
R"(
|
R"(
|
||||||
{
|
{
|
||||||
"num_heartbeats_timeout": 2,
|
"num_heartbeats_timeout": 3,
|
||||||
"gcs_failover_worker_reconnect_timeout": 4
|
"gcs_failover_worker_reconnect_timeout": 5
|
||||||
}
|
}
|
||||||
)");
|
)");
|
||||||
}
|
}
|
||||||
|
@ -68,13 +68,13 @@ TEST_F(GcsHeartbeatManagerTest, TestBasicTimeout) {
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
absl::MutexLock lock(&mutex_);
|
absl::MutexLock lock(&mutex_);
|
||||||
if (absl::Now() - start >= absl::Seconds(1)) {
|
if (absl::Now() - start >= absl::Microseconds(1800)) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
ASSERT_TRUE(dead_nodes.empty());
|
ASSERT_TRUE(dead_nodes.empty());
|
||||||
}
|
}
|
||||||
|
|
||||||
std::this_thread::sleep_for(2s);
|
std::this_thread::sleep_for(3s);
|
||||||
|
|
||||||
{
|
{
|
||||||
absl::MutexLock lock(&mutex_);
|
absl::MutexLock lock(&mutex_);
|
||||||
|
@ -89,7 +89,7 @@ TEST_F(GcsHeartbeatManagerTest, TestBasicReport) {
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
absl::MutexLock lock(&mutex_);
|
absl::MutexLock lock(&mutex_);
|
||||||
if (absl::Now() - start >= absl::Seconds(3)) {
|
if (absl::Now() - start >= absl::Seconds(4)) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
ASSERT_TRUE(dead_nodes.empty());
|
ASSERT_TRUE(dead_nodes.empty());
|
||||||
|
@ -124,13 +124,13 @@ TEST_F(GcsHeartbeatManagerTest, TestBasicRestart) {
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
absl::MutexLock lock(&mutex_);
|
absl::MutexLock lock(&mutex_);
|
||||||
if (absl::Now() - start >= absl::Seconds(3)) {
|
if (absl::Now() - start >= absl::Seconds(4)) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
ASSERT_TRUE(dead_nodes.empty());
|
ASSERT_TRUE(dead_nodes.empty());
|
||||||
}
|
}
|
||||||
|
|
||||||
std::this_thread::sleep_for(2s);
|
std::this_thread::sleep_for(3s);
|
||||||
{
|
{
|
||||||
absl::MutexLock lock(&mutex_);
|
absl::MutexLock lock(&mutex_);
|
||||||
ASSERT_EQ(std::vector<NodeID>{node_1}, dead_nodes);
|
ASSERT_EQ(std::vector<NodeID>{node_1}, dead_nodes);
|
||||||
|
@ -153,7 +153,7 @@ TEST_F(GcsHeartbeatManagerTest, TestBasicRestart2) {
|
||||||
|
|
||||||
heartbeat_manager->Initialize(init_data);
|
heartbeat_manager->Initialize(init_data);
|
||||||
|
|
||||||
while (absl::Now() - start < absl::Seconds(1)) {
|
while (absl::Now() - start < absl::Seconds(2)) {
|
||||||
io_service.post(
|
io_service.post(
|
||||||
[&]() {
|
[&]() {
|
||||||
rpc::ReportHeartbeatReply reply;
|
rpc::ReportHeartbeatReply reply;
|
||||||
|
@ -169,13 +169,13 @@ TEST_F(GcsHeartbeatManagerTest, TestBasicRestart2) {
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
absl::MutexLock lock(&mutex_);
|
absl::MutexLock lock(&mutex_);
|
||||||
if (absl::Now() - start >= absl::Seconds(1)) {
|
if (absl::Now() - start >= absl::Seconds(2)) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
ASSERT_TRUE(dead_nodes.empty());
|
ASSERT_TRUE(dead_nodes.empty());
|
||||||
}
|
}
|
||||||
|
|
||||||
std::this_thread::sleep_for(2s);
|
std::this_thread::sleep_for(3s);
|
||||||
{
|
{
|
||||||
absl::MutexLock lock(&mutex_);
|
absl::MutexLock lock(&mutex_);
|
||||||
ASSERT_EQ(std::vector<NodeID>{node_1}, dead_nodes);
|
ASSERT_EQ(std::vector<NodeID>{node_1}, dead_nodes);
|
||||||
|
|
Loading…
Add table
Reference in a new issue