Пример #1
0
 def setUp(self):
     super(GuestAgentManagerTest, self).setUp('mysql')
     self.context = trove_testtools.TroveTestContext(self)
     self.replication_strategy = 'MysqlGTIDReplication'
     self.patch_rs = patch(
         'trove.guestagent.strategies.replication.get_strategy',
         return_value=self.replication_strategy)
     self.mock_rs = self.patch_rs.start()
     self.addCleanup(self.patch_rs.stop)
     self.manager = Manager()
     self.origin_MySqlAppStatus = dbaas.MySqlAppStatus.get
     self.origin_os_path_exists = os.path.exists
     self.origin_format = volume.VolumeDevice.format
     self.origin_migrate_data = volume.VolumeDevice.migrate_data
     self.origin_mount = volume.VolumeDevice.mount
     self.origin_unmount = volume.VolumeDevice.unmount
     self.origin_mount_points = volume.VolumeDevice.mount_points
     self.origin_stop_mysql = dbaas.MySqlApp.stop_db
     self.origin_start_mysql = dbaas.MySqlApp.start_mysql
     self.origin_update_overrides = dbaas.MySqlApp.update_overrides
     self.origin_install_if_needed = dbaas.MySqlApp.install_if_needed
     self.origin_secure = dbaas.MySqlApp.secure
     self.origin_secure_root = dbaas.MySqlApp.secure_root
     self.origin_pkg_is_installed = pkg.Package.pkg_is_installed
     self.origin_os_path_exists = os.path.exists
     self.origin_chown = operating_system.chown
     # set up common mock objects, etc. for replication testing
     self.patcher_gfvs = patch(
         'trove.guestagent.dbaas.get_filesystem_volume_stats')
     self.patcher_rs = patch(
         'trove.guestagent.strategies.replication.get_instance')
     self.mock_gfvs_class = self.patcher_gfvs.start()
     self.mock_rs_class = self.patcher_rs.start()
Пример #2
0
 def setUp(self):
     super(GuestAgentManagerTest, self).setUp()
     self.context = TroveContext()
     self.manager = Manager()
     self.origin_MySqlAppStatus = dbaas.MySqlAppStatus
     self.origin_os_path_exists = os.path.exists
     self.origin_format = volume.VolumeDevice.format
     self.origin_migrate_data = volume.VolumeDevice.migrate_data
     self.origin_mount = volume.VolumeDevice.mount
     self.origin_unmount = volume.VolumeDevice.unmount
     self.origin_mount_points = volume.VolumeDevice.mount_points
     self.origin_stop_mysql = dbaas.MySqlApp.stop_db
     self.origin_start_mysql = dbaas.MySqlApp.start_mysql
     self.origin_update_overrides = dbaas.MySqlApp.update_overrides
     self.origin_pkg_is_installed = pkg.Package.pkg_is_installed
     self.origin_os_path_exists = os.path.exists
     self.origin_chown = operating_system.chown
     # set up common mock objects, etc. for replication testing
     self.patcher_gfvs = patch(
         'trove.guestagent.dbaas.get_filesystem_volume_stats')
     self.patcher_rs = patch('trove.guestagent.datastore.mysql.manager.'
                             'REPLICATION_STRATEGY_CLASS')
     self.mock_gfvs_class = self.patcher_gfvs.start()
     self.mock_rs_class = self.patcher_rs.start()
     self.repl_datastore_manager = 'mysql'
     self.repl_replication_strategy = 'MysqlGTIDReplication'
Пример #3
0
 def setUp(self):
     super(GuestAgentManagerTest, self).setUp()
     self.context = TroveContext()
     self.manager = Manager()
     self.origin_MySqlAppStatus = dbaas.MySqlAppStatus
     self.origin_os_path_exists = os.path.exists
     self.origin_format = volume.VolumeDevice.format
     self.origin_migrate_data = volume.VolumeDevice.migrate_data
     self.origin_mount = volume.VolumeDevice.mount
     self.origin_is_installed = dbaas.MySqlApp.is_installed
     self.origin_stop_mysql = dbaas.MySqlApp.stop_db
     self.origin_start_mysql = dbaas.MySqlApp.start_mysql
     self.origin_install_mysql = dbaas.MySqlApp._install_mysql
Пример #4
0
 def test_create_backup(self, backup_mock):
     # entry point
     Manager().create_backup(self.context, 'backup_id_123')
     # assertions
     backup_mock.assert_any_call(self.context, 'backup_id_123')
Пример #5
0
 def test_create_backup(self):
     backup.backup = MagicMock(return_value=None)
     # entry point
     Manager().create_backup(self.context, 'backup_id_123')
     # assertions
     backup.backup.assert_any_call(self.context, 'backup_id_123')
Пример #6
0
 def test_create_backup(self):
     when(backup).backup(self.context, 'backup_id_123').thenReturn(None)
     # entry point
     Manager().create_backup(self.context, 'backup_id_123')
     # assertions
     verify(backup).backup(self.context, 'backup_id_123')