fix test failure

Summary: as subject

Test Plan: db_test

Reviewers: dhruba, MarkCallaghan

Reviewed By: MarkCallaghan

Differential Revision: https://reviews.facebook.net/D6309
This commit is contained in:
heyongqiang 2012-10-29 16:26:20 -07:00
parent 925f60d39d
commit fb8d437325

View File

@ -1687,21 +1687,22 @@ TEST(DBTest, DBOpen_Change_NumLevels) {
DestroyDB(dbname, Options());
Options opts;
Status s;
DB* db = NULL;
opts.create_if_missing = true;
s = DB::Open(opts, dbname, &db_);
s = DB::Open(opts, dbname, &db);
ASSERT_OK(s);
ASSERT_TRUE(db_ != NULL);
db_->Put(WriteOptions(), "a", "123");
db_->Put(WriteOptions(), "b", "234");
db_->CompactRange(NULL, NULL);
delete db_;
db_ = NULL;
ASSERT_TRUE(db != NULL);
db->Put(WriteOptions(), "a", "123");
db->Put(WriteOptions(), "b", "234");
db->CompactRange(NULL, NULL);
delete db;
db = NULL;
opts.create_if_missing = false;
opts.num_levels = 2;
s = DB::Open(opts, dbname, &db_);
s = DB::Open(opts, dbname, &db);
ASSERT_TRUE(strstr(s.ToString().c_str(), "Corruption") != NULL);
ASSERT_TRUE(db_ == NULL);
ASSERT_TRUE(db == NULL);
}
// Check that number of files does not grow when we are out of space