# cleanup resource
db.volume_destroy(self.context, dst_vol_id)
- def test_create_volume_from_volume_with_glance_volume_metadata_none(self):
+ @mock.patch('cinder.utils.execute')
+ def test_create_volume_from_volume_with_glance_volume_metadata_none(
+ self, mock_execute):
# create source volume
+ mock_execute.return_value = None
src_vol = tests_utils.create_volume(self.context, **self.volume_params)
src_vol_id = src_vol['id']
db.volume_destroy(self.context, src_vol_id)
db.volume_destroy(self.context, dst_vol['id'])
+ @mock.patch('cinder.utils.execute')
def test_create_volume_from_volume_raise_metadata_copy_failure(
- self):
+ self, mock_execute):
# create source volume
+ mock_execute.return_value = None
src_vol = tests_utils.create_volume(self.context, **self.volume_params)
src_vol_id = src_vol['id']
# cleanup resource
db.volume_destroy(self.context, src_vol_id)
+ @mock.patch('cinder.utils.execute')
def test_create_volume_from_snapshot_raise_metadata_copy_failure(
- self):
+ self, mock_execute):
# create source volume
+ mock_execute.return_value = None
src_vol = tests_utils.create_volume(self.context, **self.volume_params)
src_vol_id = src_vol['id']
@mock.patch(
'cinder.volume.driver.VolumeDriver.create_replica_test_volume')
+ @mock.patch('cinder.utils.execute')
def test_create_volume_from_srcreplica_raise_metadata_copy_failure(
- self, _create_replica_test):
+ self, mock_execute, _create_replica_test):
+ mock_execute.return_value = None
_create_replica_test.return_value = None
# create source volume
src_vol = tests_utils.create_volume(self.context, **self.volume_params)
# cleanup resource
db.volume_destroy(self.context, src_vol_id)
+ @mock.patch('cinder.utils.execute')
def test_create_volume_from_snapshot_with_glance_volume_metadata_none(
- self):
+ self, mock_execute):
# create source volume
+ mock_execute.return_value = None
src_vol = tests_utils.create_volume(self.context, **self.volume_params)
src_vol_id = src_vol['id']