Skip to content

Commit

Permalink
Remove the test db dir after deleting the storage in CPP unittest (#1336
Browse files Browse the repository at this point in the history
)
  • Loading branch information
git-hulk authored Mar 20, 2023
1 parent 303384f commit 81c7c3f
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions tests/cppunit/test_base.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,15 @@ class TestBase : public testing::Test {
}
}
~TestBase() override {
auto db_dir = config_->db_dir;
delete storage_;
delete config_;

std::error_code ec;
std::filesystem::remove_all(config_->db_dir, ec);
std::filesystem::remove_all(db_dir, ec);
if (ec) {
std::cout << "Encounter filesystem error: " << ec << std::endl;
}
delete storage_;
delete config_;
}

protected:
Expand Down

0 comments on commit 81c7c3f

Please sign in to comment.