Fix BackupableDBTest
Summary: Fix BackupableDBTest.NoDoubleCopy and BackupableDBTest.DifferentEnvs by mocking the db files in db_env instead of backup_env_ Test Plan: make check -j64 Reviewers: sdong, andrewkr Reviewed By: andrewkr Subscribers: andrewkr, dhruba Differential Revision: https://reviews.facebook.net/D57273
This commit is contained in:
parent
8fffeb27d5
commit
70ebf2275b
@ -756,7 +756,7 @@ TEST_F(BackupableDBTest, NoDoubleCopy) {
|
|||||||
dummy_db_->live_files_ = { "/00010.sst", "/00011.sst",
|
dummy_db_->live_files_ = { "/00010.sst", "/00011.sst",
|
||||||
"/CURRENT", "/MANIFEST-01" };
|
"/CURRENT", "/MANIFEST-01" };
|
||||||
dummy_db_->wal_files_ = {{"/00011.log", true}, {"/00012.log", false}};
|
dummy_db_->wal_files_ = {{"/00011.log", true}, {"/00012.log", false}};
|
||||||
test_backup_env_->SetFilenamesForMockedAttrs(dummy_db_->live_files_);
|
test_db_env_->SetFilenamesForMockedAttrs(dummy_db_->live_files_);
|
||||||
ASSERT_OK(backup_engine_->CreateNewBackup(db_.get(), false));
|
ASSERT_OK(backup_engine_->CreateNewBackup(db_.get(), false));
|
||||||
std::vector<std::string> should_have_written = {
|
std::vector<std::string> should_have_written = {
|
||||||
"/shared/00010.sst.tmp", "/shared/00011.sst.tmp",
|
"/shared/00010.sst.tmp", "/shared/00011.sst.tmp",
|
||||||
@ -773,7 +773,7 @@ TEST_F(BackupableDBTest, NoDoubleCopy) {
|
|||||||
dummy_db_->live_files_ = { "/00010.sst", "/00015.sst",
|
dummy_db_->live_files_ = { "/00010.sst", "/00015.sst",
|
||||||
"/CURRENT", "/MANIFEST-01" };
|
"/CURRENT", "/MANIFEST-01" };
|
||||||
dummy_db_->wal_files_ = {{"/00011.log", true}, {"/00012.log", false}};
|
dummy_db_->wal_files_ = {{"/00011.log", true}, {"/00012.log", false}};
|
||||||
test_backup_env_->SetFilenamesForMockedAttrs(dummy_db_->live_files_);
|
test_db_env_->SetFilenamesForMockedAttrs(dummy_db_->live_files_);
|
||||||
ASSERT_OK(backup_engine_->CreateNewBackup(db_.get(), false));
|
ASSERT_OK(backup_engine_->CreateNewBackup(db_.get(), false));
|
||||||
// should not open 00010.sst - it's already there
|
// should not open 00010.sst - it's already there
|
||||||
should_have_written = {
|
should_have_written = {
|
||||||
@ -824,7 +824,7 @@ TEST_F(BackupableDBTest, DifferentEnvs) {
|
|||||||
dummy_db_->live_files_ = { "/00010.sst", "/00011.sst",
|
dummy_db_->live_files_ = { "/00010.sst", "/00011.sst",
|
||||||
"/CURRENT", "/MANIFEST-01" };
|
"/CURRENT", "/MANIFEST-01" };
|
||||||
dummy_db_->wal_files_ = {{"/00011.log", true}, {"/00012.log", false}};
|
dummy_db_->wal_files_ = {{"/00011.log", true}, {"/00012.log", false}};
|
||||||
test_backup_env_->SetFilenamesForMockedAttrs(dummy_db_->live_files_);
|
test_db_env_->SetFilenamesForMockedAttrs(dummy_db_->live_files_);
|
||||||
ASSERT_OK(backup_engine_->CreateNewBackup(db_.get(), false));
|
ASSERT_OK(backup_engine_->CreateNewBackup(db_.get(), false));
|
||||||
|
|
||||||
CloseDBAndBackupEngine();
|
CloseDBAndBackupEngine();
|
||||||
@ -836,7 +836,7 @@ TEST_F(BackupableDBTest, DifferentEnvs) {
|
|||||||
CloseDBAndBackupEngine();
|
CloseDBAndBackupEngine();
|
||||||
DestroyDB(dbname_, Options());
|
DestroyDB(dbname_, Options());
|
||||||
|
|
||||||
test_backup_env_->SetFilenamesForMockedAttrs({});
|
test_db_env_->SetFilenamesForMockedAttrs({});
|
||||||
AssertBackupConsistency(0, 0, 100, 500);
|
AssertBackupConsistency(0, 0, 100, 500);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user