Merge "Add unspecified options to backup unittests"
This commit is contained in:
commit
5b83e892bd
@ -104,6 +104,10 @@ class GuestAgentBackupTest(trove_testtools.TestCase):
|
||||
self.get_data_dir_patcher = patch.object(
|
||||
MySqlApp, 'get_data_dir', return_value='/var/lib/mysql/data')
|
||||
self.mock_get_datadir = self.get_data_dir_patcher.start()
|
||||
backupBase.BackupRunner.is_zipped = True
|
||||
backupBase.BackupRunner.is_encrypted = True
|
||||
restoreBase.RestoreRunner.is_zipped = True
|
||||
restoreBase.RestoreRunner.is_encrypted = True
|
||||
|
||||
def tearDown(self):
|
||||
super(GuestAgentBackupTest, self).tearDown()
|
||||
@ -111,7 +115,6 @@ class GuestAgentBackupTest(trove_testtools.TestCase):
|
||||
self.get_data_dir_patcher.stop()
|
||||
|
||||
def test_backup_decrypted_xtrabackup_command(self):
|
||||
backupBase.BackupRunner.is_zipped = True
|
||||
backupBase.BackupRunner.is_encrypted = False
|
||||
RunnerClass = utils.import_class(BACKUP_XTRA_CLS)
|
||||
bkup = RunnerClass(12345, extra_opts="")
|
||||
@ -119,7 +122,6 @@ class GuestAgentBackupTest(trove_testtools.TestCase):
|
||||
self.assertEqual("12345.xbstream.gz", bkup.manifest)
|
||||
|
||||
def test_backup_decrypted_xtrabackup_with_extra_opts_command(self):
|
||||
backupBase.BackupRunner.is_zipped = True
|
||||
backupBase.BackupRunner.is_encrypted = False
|
||||
RunnerClass = utils.import_class(BACKUP_XTRA_CLS)
|
||||
bkup = RunnerClass(12345, extra_opts="--no-lock")
|
||||
@ -127,8 +129,6 @@ class GuestAgentBackupTest(trove_testtools.TestCase):
|
||||
self.assertEqual("12345.xbstream.gz", bkup.manifest)
|
||||
|
||||
def test_backup_encrypted_xtrabackup_command(self):
|
||||
backupBase.BackupRunner.is_zipped = True
|
||||
backupBase.BackupRunner.is_encrypted = True
|
||||
backupBase.BackupRunner.encrypt_key = CRYPTO_KEY
|
||||
RunnerClass = utils.import_class(BACKUP_XTRA_CLS)
|
||||
bkup = RunnerClass(12345, extra_opts="")
|
||||
@ -137,7 +137,6 @@ class GuestAgentBackupTest(trove_testtools.TestCase):
|
||||
self.assertEqual("12345.xbstream.gz.enc", bkup.manifest)
|
||||
|
||||
def test_backup_xtrabackup_incremental(self):
|
||||
backupBase.BackupRunner.is_zipped = True
|
||||
backupBase.BackupRunner.is_encrypted = False
|
||||
RunnerClass = utils.import_class(BACKUP_XTRA_INCR_CLS)
|
||||
opts = {'lsn': '54321', 'extra_opts': ''}
|
||||
@ -147,7 +146,6 @@ class GuestAgentBackupTest(trove_testtools.TestCase):
|
||||
self.assertEqual("12345.xbstream.gz", bkup.manifest)
|
||||
|
||||
def test_backup_xtrabackup_incremental_with_extra_opts_command(self):
|
||||
backupBase.BackupRunner.is_zipped = True
|
||||
backupBase.BackupRunner.is_encrypted = False
|
||||
RunnerClass = utils.import_class(BACKUP_XTRA_INCR_CLS)
|
||||
opts = {'lsn': '54321', 'extra_opts': '--no-lock'}
|
||||
@ -157,8 +155,6 @@ class GuestAgentBackupTest(trove_testtools.TestCase):
|
||||
self.assertEqual("12345.xbstream.gz", bkup.manifest)
|
||||
|
||||
def test_backup_xtrabackup_incremental_encrypted(self):
|
||||
backupBase.BackupRunner.is_zipped = True
|
||||
backupBase.BackupRunner.is_encrypted = True
|
||||
backupBase.BackupRunner.encrypt_key = CRYPTO_KEY
|
||||
RunnerClass = utils.import_class(BACKUP_XTRA_INCR_CLS)
|
||||
opts = {'lsn': '54321', 'extra_opts': ''}
|
||||
@ -168,7 +164,6 @@ class GuestAgentBackupTest(trove_testtools.TestCase):
|
||||
self.assertEqual("12345.xbstream.gz.enc", bkup.manifest)
|
||||
|
||||
def test_backup_decrypted_mysqldump_command(self):
|
||||
backupBase.BackupRunner.is_zipped = True
|
||||
backupBase.BackupRunner.is_encrypted = False
|
||||
RunnerClass = utils.import_class(BACKUP_SQLDUMP_CLS)
|
||||
bkup = RunnerClass(12345, extra_opts="")
|
||||
@ -176,7 +171,6 @@ class GuestAgentBackupTest(trove_testtools.TestCase):
|
||||
self.assertEqual("12345.gz", bkup.manifest)
|
||||
|
||||
def test_backup_decrypted_mysqldump_with_extra_opts_command(self):
|
||||
backupBase.BackupRunner.is_zipped = True
|
||||
backupBase.BackupRunner.is_encrypted = False
|
||||
RunnerClass = utils.import_class(BACKUP_SQLDUMP_CLS)
|
||||
bkup = RunnerClass(12345, extra_opts="--events --routines --triggers")
|
||||
@ -184,8 +178,6 @@ class GuestAgentBackupTest(trove_testtools.TestCase):
|
||||
self.assertEqual("12345.gz", bkup.manifest)
|
||||
|
||||
def test_backup_encrypted_mysqldump_command(self):
|
||||
backupBase.BackupRunner.is_zipped = True
|
||||
backupBase.BackupRunner.is_encrypted = True
|
||||
backupBase.BackupRunner.encrypt_key = CRYPTO_KEY
|
||||
RunnerClass = utils.import_class(BACKUP_SQLDUMP_CLS)
|
||||
bkup = RunnerClass(12345, user="user",
|
||||
@ -195,7 +187,6 @@ class GuestAgentBackupTest(trove_testtools.TestCase):
|
||||
self.assertEqual("12345.gz.enc", bkup.manifest)
|
||||
|
||||
def test_restore_decrypted_xtrabackup_command(self):
|
||||
restoreBase.RestoreRunner.is_zipped = True
|
||||
restoreBase.RestoreRunner.is_encrypted = False
|
||||
RunnerClass = utils.import_class(RESTORE_XTRA_CLS)
|
||||
restr = RunnerClass(None, restore_location="/var/lib/mysql/data",
|
||||
@ -204,8 +195,6 @@ class GuestAgentBackupTest(trove_testtools.TestCase):
|
||||
self.assertEqual(PREPARE, restr.prepare_cmd)
|
||||
|
||||
def test_restore_encrypted_xtrabackup_command(self):
|
||||
restoreBase.RestoreRunner.is_zipped = True
|
||||
restoreBase.RestoreRunner.is_encrypted = True
|
||||
restoreBase.RestoreRunner.decrypt_key = CRYPTO_KEY
|
||||
RunnerClass = utils.import_class(RESTORE_XTRA_CLS)
|
||||
restr = RunnerClass(None, restore_location="/var/lib/mysql/data",
|
||||
@ -230,7 +219,6 @@ class GuestAgentBackupTest(trove_testtools.TestCase):
|
||||
self.assertEqual(expected, observed)
|
||||
|
||||
def test_restore_decrypted_xtrabackup_incremental_command(self):
|
||||
restoreBase.RestoreRunner.is_zipped = True
|
||||
restoreBase.RestoreRunner.is_encrypted = False
|
||||
RunnerClass = utils.import_class(RESTORE_XTRA_INCR_CLS)
|
||||
restr = RunnerClass(None, restore_location="/var/lib/mysql/data",
|
||||
@ -245,8 +233,6 @@ class GuestAgentBackupTest(trove_testtools.TestCase):
|
||||
self.assertEqual(expected, observed)
|
||||
|
||||
def test_restore_encrypted_xtrabackup_incremental_command(self):
|
||||
restoreBase.RestoreRunner.is_zipped = True
|
||||
restoreBase.RestoreRunner.is_encrypted = True
|
||||
restoreBase.RestoreRunner.decrypt_key = CRYPTO_KEY
|
||||
RunnerClass = utils.import_class(RESTORE_XTRA_INCR_CLS)
|
||||
restr = RunnerClass(None, restore_location="/var/lib/mysql/data",
|
||||
@ -261,7 +247,6 @@ class GuestAgentBackupTest(trove_testtools.TestCase):
|
||||
self.assertEqual(expected, observed)
|
||||
|
||||
def test_restore_decrypted_mysqldump_command(self):
|
||||
restoreBase.RestoreRunner.is_zipped = True
|
||||
restoreBase.RestoreRunner.is_encrypted = False
|
||||
RunnerClass = utils.import_class(RESTORE_SQLDUMP_CLS)
|
||||
restr = RunnerClass(None, restore_location="/var/lib/mysql/data",
|
||||
@ -269,8 +254,6 @@ class GuestAgentBackupTest(trove_testtools.TestCase):
|
||||
self.assertEqual(UNZIP + PIPE + SQLDUMP_RESTORE, restr.restore_cmd)
|
||||
|
||||
def test_restore_encrypted_mysqldump_command(self):
|
||||
restoreBase.RestoreRunner.is_zipped = True
|
||||
restoreBase.RestoreRunner.is_encrypted = True
|
||||
restoreBase.RestoreRunner.decrypt_key = CRYPTO_KEY
|
||||
RunnerClass = utils.import_class(RESTORE_SQLDUMP_CLS)
|
||||
restr = RunnerClass(None, restore_location="/var/lib/mysql/data",
|
||||
@ -279,7 +262,6 @@ class GuestAgentBackupTest(trove_testtools.TestCase):
|
||||
restr.restore_cmd)
|
||||
|
||||
def test_backup_encrypted_cbbackup_command(self):
|
||||
backupBase.BackupRunner.is_encrypted = True
|
||||
backupBase.BackupRunner.encrypt_key = CRYPTO_KEY
|
||||
RunnerClass = utils.import_class(BACKUP_CBBACKUP_CLS)
|
||||
utils.execute_with_timeout = mock.Mock(return_value=None)
|
||||
@ -300,7 +282,6 @@ class GuestAgentBackupTest(trove_testtools.TestCase):
|
||||
self.assertIn("gz", bkp.manifest)
|
||||
|
||||
def test_restore_decrypted_cbbackup_command(self):
|
||||
restoreBase.RestoreRunner.is_zipped = True
|
||||
restoreBase.RestoreRunner.is_encrypted = False
|
||||
RunnerClass = utils.import_class(RESTORE_CBBACKUP_CLS)
|
||||
restr = RunnerClass(None, restore_location="/tmp",
|
||||
@ -308,8 +289,6 @@ class GuestAgentBackupTest(trove_testtools.TestCase):
|
||||
self.assertEqual(UNZIP + PIPE + CBBACKUP_RESTORE, restr.restore_cmd)
|
||||
|
||||
def test_restore_encrypted_cbbackup_command(self):
|
||||
restoreBase.RestoreRunner.is_zipped = True
|
||||
restoreBase.RestoreRunner.is_encrypted = True
|
||||
restoreBase.RestoreRunner.decrypt_key = CRYPTO_KEY
|
||||
RunnerClass = utils.import_class(RESTORE_CBBACKUP_CLS)
|
||||
restr = RunnerClass(None, restore_location="/tmp",
|
||||
@ -335,7 +314,6 @@ class GuestAgentBackupTest(trove_testtools.TestCase):
|
||||
|
||||
@mock.patch.object(MongoDBApp, '_init_overrides_dir')
|
||||
def test_backup_encrypted_mongodump_command(self, _):
|
||||
backupBase.BackupRunner.is_encrypted = True
|
||||
backupBase.BackupRunner.encrypt_key = CRYPTO_KEY
|
||||
RunnerClass = utils.import_class(BACKUP_MONGODUMP_CLS)
|
||||
utils.execute_with_timeout = mock.Mock(return_value=None)
|
||||
@ -358,7 +336,6 @@ class GuestAgentBackupTest(trove_testtools.TestCase):
|
||||
|
||||
@mock.patch.object(MongoDBApp, '_init_overrides_dir')
|
||||
def test_restore_decrypted_mongodump_command(self, _):
|
||||
restoreBase.RestoreRunner.is_zipped = True
|
||||
restoreBase.RestoreRunner.is_encrypted = False
|
||||
RunnerClass = utils.import_class(RESTORE_MONGODUMP_CLS)
|
||||
restr = RunnerClass(None, restore_location="/tmp",
|
||||
@ -367,8 +344,6 @@ class GuestAgentBackupTest(trove_testtools.TestCase):
|
||||
|
||||
@mock.patch.object(MongoDBApp, '_init_overrides_dir')
|
||||
def test_restore_encrypted_mongodump_command(self, _):
|
||||
restoreBase.RestoreRunner.is_zipped = True
|
||||
restoreBase.RestoreRunner.is_encrypted = True
|
||||
restoreBase.RestoreRunner.decrypt_key = CRYPTO_KEY
|
||||
RunnerClass = utils.import_class(RESTORE_MONGODUMP_CLS)
|
||||
restr = RunnerClass(None, restore_location="/tmp",
|
||||
@ -381,7 +356,6 @@ class GuestAgentBackupTest(trove_testtools.TestCase):
|
||||
mock.Mock(return_value={'dir': '/var/lib/redis',
|
||||
'dbfilename': 'dump.rdb'}))
|
||||
def test_backup_encrypted_redisbackup_command(self, *mocks):
|
||||
backupBase.BackupRunner.is_encrypted = True
|
||||
backupBase.BackupRunner.encrypt_key = CRYPTO_KEY
|
||||
RunnerClass = utils.import_class(BACKUP_REDIS_CLS)
|
||||
bkp = RunnerClass(12345)
|
||||
@ -409,7 +383,6 @@ class GuestAgentBackupTest(trove_testtools.TestCase):
|
||||
@patch.object(operating_system, 'chown')
|
||||
@patch.object(operating_system, 'create_directory')
|
||||
def test_restore_decrypted_redisbackup_command(self, *mocks):
|
||||
restoreBase.RestoreRunner.is_zipped = True
|
||||
restoreBase.RestoreRunner.is_encrypted = False
|
||||
RunnerClass = utils.import_class(RESTORE_REDIS_CLS)
|
||||
restr = RunnerClass(None, restore_location="/tmp",
|
||||
@ -422,8 +395,6 @@ class GuestAgentBackupTest(trove_testtools.TestCase):
|
||||
@patch.object(operating_system, 'chown')
|
||||
@patch.object(operating_system, 'create_directory')
|
||||
def test_restore_encrypted_redisbackup_command(self, *mocks):
|
||||
restoreBase.RestoreRunner.is_zipped = True
|
||||
restoreBase.RestoreRunner.is_encrypted = True
|
||||
restoreBase.RestoreRunner.decrypt_key = CRYPTO_KEY
|
||||
RunnerClass = utils.import_class(RESTORE_REDIS_CLS)
|
||||
restr = RunnerClass(None, restore_location="/tmp",
|
||||
|
Loading…
x
Reference in New Issue
Block a user