Skip to content

Commit

Permalink
2
Browse files Browse the repository at this point in the history
  • Loading branch information
acelyc111 committed May 26, 2023
1 parent b563483 commit 4b57da3
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 22 deletions.
6 changes: 3 additions & 3 deletions src/replica/test/replica_disk_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -243,16 +243,16 @@ TEST_F(replica_disk_test, disk_status_test)
{disk_status::SPACE_INSUFFICIENT, disk_status::NORMAL}};
auto dn = stub->get_fs_manager()->get_dir_nodes()[0];
for (const auto &test : tests) {
update_node_status(dn, test.old_status, test.new_status);
dn->status = test.new_status;
for (const auto &pids_of_app : dn->holding_replicas) {
for (const auto &pid : pids_of_app.second) {
replica_ptr rep = stub->get_replica(pid);
ASSERT_NE(nullptr, rep);
ASSERT_EQ(test.new_status, rep->disk_space_insufficient());
ASSERT_EQ(test.new_status, rep->get_dir_node()->status);
}
}
}
update_node_status(dn, disk_status::NORMAL, disk_status::NORMAL);
dn->status = disk_status::NORMAL;
}

TEST_F(replica_disk_test, add_new_disk_test)
Expand Down
19 changes: 0 additions & 19 deletions src/replica/test/replica_disk_test_base.h
Original file line number Diff line number Diff line change
Expand Up @@ -100,25 +100,6 @@ class replica_disk_test_base : public replica_test_base
}
}

void update_node_status(const std::shared_ptr<dir_node> &dn,
disk_status::type old_status,
disk_status::type new_status)
{
for (const auto &pids_of_app : dn->holding_replicas) {
for (const auto &pid : pids_of_app.second) {
replica_ptr rep = stub->get_replica(pid);
ASSERT_NE(nullptr, rep);
rep->set_disk_status(new_status);
}
}
if (old_status != new_status) {
dn->status = new_status;
}
}

// if (dn->status == disk_status::NORMAL) {
// dir_size++;
// }
void prepare_before_add_new_disk_test(const std::string &create_dir,
const std::string &check_rw)
{
Expand Down

0 comments on commit 4b57da3

Please sign in to comment.