mirror of
https://github.com/wassname/ray.git
synced 2026-06-29 21:08:50 +08:00
[GCS]Fix TestActorSubscribeAll bug (#13193)
This commit is contained in:
@@ -588,6 +588,29 @@ TEST_F(ServiceBasedGcsClientTest, TestJobInfo) {
|
||||
WaitForExpectedCount(job_updates, 2);
|
||||
}
|
||||
|
||||
TEST_F(ServiceBasedGcsClientTest, TestActorSubscribeAll) {
|
||||
// NOTE: `TestActorSubscribeAll` will subscribe to all actor messages, so we need to
|
||||
// execute it before `TestActorInfo`, otherwise `TestActorSubscribeAll` will receive
|
||||
// messages from `TestActorInfo`.
|
||||
// Create actor table data.
|
||||
JobID job_id = JobID::FromInt(1);
|
||||
auto actor_table_data1 = Mocker::GenActorTableData(job_id);
|
||||
auto actor_table_data2 = Mocker::GenActorTableData(job_id);
|
||||
|
||||
// Subscribe to any register or update operations of actors.
|
||||
std::atomic<int> actor_update_count(0);
|
||||
auto on_subscribe = [&actor_update_count](const ActorID &actor_id,
|
||||
const gcs::ActorTableData &data) {
|
||||
++actor_update_count;
|
||||
};
|
||||
ASSERT_TRUE(SubscribeAllActors(on_subscribe));
|
||||
|
||||
// Register an actor to GCS.
|
||||
RegisterActor(actor_table_data1, false);
|
||||
RegisterActor(actor_table_data2, false);
|
||||
WaitForExpectedCount(actor_update_count, 2);
|
||||
}
|
||||
|
||||
TEST_F(ServiceBasedGcsClientTest, TestActorInfo) {
|
||||
// Create actor table data.
|
||||
JobID job_id = JobID::FromInt(1);
|
||||
@@ -611,26 +634,6 @@ TEST_F(ServiceBasedGcsClientTest, TestActorInfo) {
|
||||
WaitForActorUnsubscribed(actor_id);
|
||||
}
|
||||
|
||||
TEST_F(ServiceBasedGcsClientTest, TestActorSubscribeAll) {
|
||||
// Create actor table data.
|
||||
JobID job_id = JobID::FromInt(1);
|
||||
auto actor_table_data1 = Mocker::GenActorTableData(job_id);
|
||||
auto actor_table_data2 = Mocker::GenActorTableData(job_id);
|
||||
|
||||
// Subscribe to any register or update operations of actors.
|
||||
std::atomic<int> actor_update_count(0);
|
||||
auto on_subscribe = [&actor_update_count](const ActorID &actor_id,
|
||||
const gcs::ActorTableData &data) {
|
||||
++actor_update_count;
|
||||
};
|
||||
ASSERT_TRUE(SubscribeAllActors(on_subscribe));
|
||||
|
||||
// Register an actor to GCS.
|
||||
RegisterActor(actor_table_data1, false);
|
||||
RegisterActor(actor_table_data2, false);
|
||||
WaitForExpectedCount(actor_update_count, 2);
|
||||
}
|
||||
|
||||
TEST_F(ServiceBasedGcsClientTest, TestNodeInfo) {
|
||||
// Create gcs node info.
|
||||
auto gcs_node1_info = Mocker::GenNodeInfo();
|
||||
|
||||
Reference in New Issue
Block a user