Skip to content

Commit

Permalink
Re-enable param tests for backup engine (facebook#7260)
Browse files Browse the repository at this point in the history
Summary:
The param tests did not take any effect previously. This PR re-enables it.

Pull Request resolved: facebook#7260

Test Plan: Some manual tests and `./backupable_db_test`.

Reviewed By: siying

Differential Revision: D23140902

Pulled By: pdillinger

fbshipit-source-id: cd62b11b926affed25127d9074fa97a1c7f748c4
  • Loading branch information
gg814 authored and codingrhythm committed Mar 5, 2021
1 parent 6bfb36f commit 6c9205b
Showing 1 changed file with 22 additions and 8 deletions.
30 changes: 22 additions & 8 deletions utilities/backupable/backupable_db_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -746,10 +746,8 @@ class BackupableDBTest : public testing::Test {
db_.reset(db);
}

void OpenDBAndBackupEngine(bool destroy_old_data = false, bool dummy = false,
ShareOption shared_option = kShareNoChecksum) {
// reset all the defaults
test_backup_env_->SetLimitWrittenFiles(1000000);
void InitializeDBAndBackupEngine(bool dummy = false) {
// reset all the db env defaults
test_db_env_->SetLimitWrittenFiles(1000000);
test_db_env_->SetDummySequentialFile(dummy);

Expand All @@ -761,14 +759,19 @@ class BackupableDBTest : public testing::Test {
ASSERT_OK(DB::Open(options_, dbname_, &db));
}
db_.reset(db);
}

virtual void OpenDBAndBackupEngine(
bool destroy_old_data = false, bool dummy = false,
ShareOption shared_option = kShareNoChecksum) {
InitializeDBAndBackupEngine(dummy);
// reset backup env defaults
test_backup_env_->SetLimitWrittenFiles(1000000);
backupable_options_->destroy_old_data = destroy_old_data;
backupable_options_->share_table_files = shared_option != kNoShare;
backupable_options_->share_files_with_checksum =
shared_option == kShareWithChecksum;
BackupEngine* backup_engine;
ASSERT_OK(BackupEngine::Open(test_db_env_.get(), *backupable_options_,
&backup_engine));
backup_engine_.reset(backup_engine);
OpenBackupEngine(destroy_old_data);
}

void CloseDBAndBackupEngine() {
Expand Down Expand Up @@ -906,6 +909,17 @@ class BackupableDBTestWithParam : public BackupableDBTest,
BackupableDBTestWithParam() {
backupable_options_->share_files_with_checksum = GetParam();
}
void OpenDBAndBackupEngine(
bool destroy_old_data = false, bool dummy = false,
ShareOption shared_option = kShareNoChecksum) override {
BackupableDBTest::InitializeDBAndBackupEngine(dummy);
// reset backup env defaults
test_backup_env_->SetLimitWrittenFiles(1000000);
backupable_options_->destroy_old_data = destroy_old_data;
backupable_options_->share_table_files = shared_option != kNoShare;
// NOTE: keep share_files_with_checksum setting from constructor
OpenBackupEngine(destroy_old_data);
}
};

TEST_F(BackupableDBTest, DbAndBackupSameCustomChecksum) {
Expand Down

0 comments on commit 6c9205b

Please sign in to comment.