'Test of when an exception occurs in backup().
In backup(), after an exception occurs in
self._backup_metadata(), we want to check the process of an
exception handler.'

@gcs_client
@mock.patch.object(google_dr.GoogleBackupDriver, '_backup_metadata', fake_backup_metadata)
def test_backup_backup_metadata_fail(self):

    volume_id = '020d9142-339c-4876-a445-000000f1520c'
    backup = self._create_backup_db_entry(volume_id=volume_id)
    self.flags(backup_compression_algorithm='none')
    service = google_dr.GoogleBackupDriver(self.ctxt)
    self.volume_file.seek(0)
    self.assertRaises(exception.BackupDriverException, service.backup, backup, self.volume_file)
