mirror of
https://github.com/vale981/ray
synced 2025-03-05 18:11:42 -05:00
[ci] Deflakey gcs_heartbeat_test in windows. (#27275)
We need to check the time after acquiring the lock to make sure the correctness. Otherwise, it might wait for the lock and the heartbeat has been updated.
This commit is contained in:
parent
8bdeb30510
commit
4ef4ec8eed
1 changed files with 16 additions and 4 deletions
|
@ -66,8 +66,11 @@ TEST_F(GcsHeartbeatManagerTest, TestBasicTimeout) {
|
|||
auto start = absl::Now();
|
||||
AddNode(node_1);
|
||||
|
||||
while (absl::Now() - start < absl::Seconds(1)) {
|
||||
while (true) {
|
||||
absl::MutexLock lock(&mutex_);
|
||||
if (absl::Now() - start >= absl::Seconds(1)) {
|
||||
break;
|
||||
}
|
||||
ASSERT_TRUE(dead_nodes.empty());
|
||||
}
|
||||
|
||||
|
@ -84,8 +87,11 @@ TEST_F(GcsHeartbeatManagerTest, TestBasicReport) {
|
|||
auto start = absl::Now();
|
||||
AddNode(node_1);
|
||||
|
||||
while (absl::Now() - start < absl::Seconds(3)) {
|
||||
while (true) {
|
||||
absl::MutexLock lock(&mutex_);
|
||||
if (absl::Now() - start >= absl::Seconds(3)) {
|
||||
break;
|
||||
}
|
||||
ASSERT_TRUE(dead_nodes.empty());
|
||||
io_service.post(
|
||||
[&]() {
|
||||
|
@ -116,8 +122,11 @@ TEST_F(GcsHeartbeatManagerTest, TestBasicRestart) {
|
|||
|
||||
heartbeat_manager->Initialize(init_data);
|
||||
|
||||
while (absl::Now() - start < absl::Seconds(3)) {
|
||||
while (true) {
|
||||
absl::MutexLock lock(&mutex_);
|
||||
if (absl::Now() - start >= absl::Seconds(3)) {
|
||||
break;
|
||||
}
|
||||
ASSERT_TRUE(dead_nodes.empty());
|
||||
}
|
||||
|
||||
|
@ -158,8 +167,11 @@ TEST_F(GcsHeartbeatManagerTest, TestBasicRestart2) {
|
|||
std::this_thread::sleep_for(0.1s);
|
||||
}
|
||||
|
||||
while (absl::Now() - start < absl::Seconds(1)) {
|
||||
while (true) {
|
||||
absl::MutexLock lock(&mutex_);
|
||||
if (absl::Now() - start >= absl::Seconds(1)) {
|
||||
break;
|
||||
}
|
||||
ASSERT_TRUE(dead_nodes.empty());
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue