Fix directory name for db_basic_test

Summary:
It was using the same directory as `db_options_test` so transiently failed when unit tests were run in parallel.
Closes https://github.com/facebook/rocksdb/pull/3352

Differential Revision: D6691649

Pulled By: ajkr

fbshipit-source-id: bee433484fec4faedd5cadf2db3c92fdcc99a170
main
Andrew Kryczka 7 years ago committed by Facebook Github Bot
parent 199405192d
commit 0c6e8be9e2
  1. 12
      db/db_basic_test.cc

@ -570,19 +570,19 @@ TEST_F(DBBasicTest, CompactBetweenSnapshots) {
TEST_F(DBBasicTest, DBOpen_Options) { TEST_F(DBBasicTest, DBOpen_Options) {
Options options = CurrentOptions(); Options options = CurrentOptions();
std::string dbname = test::TmpDir(env_) + "/db_options_test"; Close();
ASSERT_OK(DestroyDB(dbname, options)); Destroy(options);
// Does not exist, and create_if_missing == false: error // Does not exist, and create_if_missing == false: error
DB* db = nullptr; DB* db = nullptr;
options.create_if_missing = false; options.create_if_missing = false;
Status s = DB::Open(options, dbname, &db); Status s = DB::Open(options, dbname_, &db);
ASSERT_TRUE(strstr(s.ToString().c_str(), "does not exist") != nullptr); ASSERT_TRUE(strstr(s.ToString().c_str(), "does not exist") != nullptr);
ASSERT_TRUE(db == nullptr); ASSERT_TRUE(db == nullptr);
// Does not exist, and create_if_missing == true: OK // Does not exist, and create_if_missing == true: OK
options.create_if_missing = true; options.create_if_missing = true;
s = DB::Open(options, dbname, &db); s = DB::Open(options, dbname_, &db);
ASSERT_OK(s); ASSERT_OK(s);
ASSERT_TRUE(db != nullptr); ASSERT_TRUE(db != nullptr);
@ -592,14 +592,14 @@ TEST_F(DBBasicTest, DBOpen_Options) {
// Does exist, and error_if_exists == true: error // Does exist, and error_if_exists == true: error
options.create_if_missing = false; options.create_if_missing = false;
options.error_if_exists = true; options.error_if_exists = true;
s = DB::Open(options, dbname, &db); s = DB::Open(options, dbname_, &db);
ASSERT_TRUE(strstr(s.ToString().c_str(), "exists") != nullptr); ASSERT_TRUE(strstr(s.ToString().c_str(), "exists") != nullptr);
ASSERT_TRUE(db == nullptr); ASSERT_TRUE(db == nullptr);
// Does exist, and error_if_exists == false: OK // Does exist, and error_if_exists == false: OK
options.create_if_missing = true; options.create_if_missing = true;
options.error_if_exists = false; options.error_if_exists = false;
s = DB::Open(options, dbname, &db); s = DB::Open(options, dbname_, &db);
ASSERT_OK(s); ASSERT_OK(s);
ASSERT_TRUE(db != nullptr); ASSERT_TRUE(db != nullptr);

Loading…
Cancel
Save