TEST_F(testsCombinedBlockStore, Basic2IbpSetPutGetMemCheck) { std::string ibp1Path = std::string(MKTMPNAME()) + "_IBP1"; FileTools::createDirectory(ibp1Path); std::string ibp2Path = std::string(MKTMPNAME()) + "_IBP2"; FileTools::createDirectory(ibp2Path); std::vector<std::string> ibpsPath; ibpsPath.emplace_back(ibp1Path); ibpsPath.emplace_back(ibp2Path); CombinedBlockStore db(ibpsPath); EXPECT_TRUE(db.isClosed()); db.open(); EXPECT_FALSE(db.isClosed()); StatusCode stPut = db.put("key", "data"); EXPECT_TRUE(stPut.ok()); std::string fetched; StatusCode stGet = db.get("key", &fetched); EXPECT_TRUE(stGet.ok()); EXPECT_TRUE(fetched == "data"); std::string stats; EXPECT_TRUE(db.getStats(stats)); EXPECT_FALSE(stats.empty()); EXPECT_FALSE(db.isClosed()); db.close(); EXPECT_TRUE(db.isClosed()); EXPECT_TRUE(db.repair().ok()); FileTools::removeDirectory(ibp1Path); FileTools::removeDirectory(ibp2Path); }
TEST_F(testsLevelDbFacade, BasicLevelDbFacadePutGetMemCheck) { std::vector<bool> falseTrue = { false, true }; for (bool param1 : falseTrue) { for (bool param2 : falseTrue) { for (bool param3 : falseTrue) { std::string dbPath = std::string(MKTMPNAME()) + "_IBP"; FileTools::createDirectory(dbPath); LevelDbFacade db(dbPath, param1, param2, param3); EXPECT_TRUE(db.isClosed()); db.open(); EXPECT_FALSE(db.isClosed()); StatusCode stPut = db.put("key", "data"); EXPECT_TRUE(stPut.ok()); std::string fetched; StatusCode stGet = db.get("key", &fetched); EXPECT_TRUE(stGet.ok()); EXPECT_TRUE(fetched == "data"); EXPECT_FALSE(db.isClosed()); db.close(); EXPECT_TRUE(db.isClosed()); std::string output; db.getStats(output); FileTools::removeDirectory(dbPath); } } } }