diff --git a/tests/cppunit/test_base.h b/tests/cppunit/test_base.h index a62043b05e3..cd8c4fec3f0 100644 --- a/tests/cppunit/test_base.h +++ b/tests/cppunit/test_base.h @@ -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: