You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kvrocks.apache.org by hu...@apache.org on 2023/03/20 11:11:01 UTC

[incubator-kvrocks] branch unstable updated: Remove the test db dir after deleting the storage in CPP unittest (#1336)

This is an automated email from the ASF dual-hosted git repository.

hulk pushed a commit to branch unstable
in repository https://gitbox.apache.org/repos/asf/incubator-kvrocks.git


The following commit(s) were added to refs/heads/unstable by this push:
     new 81c7c3f2 Remove the test db dir after deleting the storage in CPP unittest (#1336)
81c7c3f2 is described below

commit 81c7c3f2d1a4e560105dd293f843380a8e253058
Author: hulk <hu...@gmail.com>
AuthorDate: Mon Mar 20 19:10:54 2023 +0800

    Remove the test db dir after deleting the storage in CPP unittest (#1336)
---
 tests/cppunit/test_base.h | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/tests/cppunit/test_base.h b/tests/cppunit/test_base.h
index a62043b0..cd8c4fec 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: