"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "cinder/tests/unit/volume/drivers/test_rbd.py" between
cinder-17.0.0.tar.gz and cinder-17.0.1.tar.gz

About: OpenStack Cinder (Core Service: Block Storage) provides persistent block storage to running instances. Its pluggable driver architecture facilitates the creation and management of block storage devices.
The "Victoria" series (latest release).

test_rbd.py  (cinder-17.0.0):test_rbd.py  (cinder-17.0.1)
skipping to change at line 1164 skipping to change at line 1164
self.volume_b.size = 20 self.volume_b.size = 20
self.driver.create_cloned_volume(self.volume_b, self.volume_a) self.driver.create_cloned_volume(self.volume_b, self.volume_a)
self.assertEqual(1, mock_resize.call_count) self.assertEqual(1, mock_resize.call_count)
@common_mocks @common_mocks
@mock.patch.object(driver.RBDDriver, '_enable_replication') @mock.patch.object(driver.RBDDriver, '_enable_replication')
def test_create_cloned_volume_w_flatten(self, mock_enable_repl): def test_create_cloned_volume_w_flatten(self, mock_enable_repl):
self.cfg.rbd_max_clone_depth = 1 self.cfg.rbd_max_clone_depth = 1
client = self.mock_client.return_value
client.__enter__.return_value = client
with mock.patch.object(self.driver, '_get_clone_info') as \ with mock.patch.object(self.driver, '_get_clone_info') as \
mock_get_clone_info: mock_get_clone_info:
mock_get_clone_info.return_value = ( mock_get_clone_info.return_value = (
('fake_pool', self.volume_b.name, ('fake_pool', self.volume_b.name,
'.'.join((self.volume_b.name, 'clone_snap')))) '.'.join((self.volume_b.name, 'clone_snap'))))
with mock.patch.object(self.driver, '_get_clone_depth') as \ with mock.patch.object(self.driver, '_get_clone_depth') as \
mock_get_clone_depth: mock_get_clone_depth:
# Try with no flatten required # Try with no flatten required
mock_get_clone_depth.return_value = 1 mock_get_clone_depth.return_value = 1
skipping to change at line 1193 skipping to change at line 1196
(self.volume_b.name, 'clone_snap')))) (self.volume_b.name, 'clone_snap'))))
self.assertEqual( self.assertEqual(
1, self.mock_rbd.RBD.return_value.clone.call_count) 1, self.mock_rbd.RBD.return_value.clone.call_count)
(self.mock_rbd.Image.return_value.unprotect_snap (self.mock_rbd.Image.return_value.unprotect_snap
.assert_called_once_with('.'.join( .assert_called_once_with('.'.join(
(self.volume_b.name, 'clone_snap')))) (self.volume_b.name, 'clone_snap'))))
(self.mock_rbd.Image.return_value.remove_snap (self.mock_rbd.Image.return_value.remove_snap
.assert_called_once_with('.'.join( .assert_called_once_with('.'.join(
(self.volume_b.name, 'clone_snap')))) (self.volume_b.name, 'clone_snap'))))
# We expect the driver to close both volumes, so 2 is expected self.mock_proxy.assert_called_once_with(
self.driver, self.volume_b.name,
client=client, ioctx=client.ioctx)
# Source volume is closed by direct call of close()
self.assertEqual( self.assertEqual(
2, self.mock_rbd.Image.return_value.close.call_count) 1, self.mock_rbd.Image.return_value.close.call_count)
self.assertTrue(mock_get_clone_depth.called) self.assertTrue(mock_get_clone_depth.called)
mock_enable_repl.assert_not_called() mock_enable_repl.assert_not_called()
@common_mocks @common_mocks
@mock.patch.object(driver.RBDDriver, '_enable_replication') @mock.patch.object(driver.RBDDriver, '_enable_replication')
def test_create_cloned_volume_w_clone_exception(self, mock_enable_repl): def test_create_cloned_volume_w_clone_exception(self, mock_enable_repl):
self.cfg.rbd_max_clone_depth = 2 self.cfg.rbd_max_clone_depth = 2
self.mock_rbd.RBD.return_value.clone.side_effect = ( self.mock_rbd.RBD.return_value.clone.side_effect = (
self.mock_rbd.RBD.Error) self.mock_rbd.RBD.Error)
with mock.patch.object(self.driver, '_get_clone_depth') as \ with mock.patch.object(self.driver, '_get_clone_depth') as \
 End of changes. 3 change blocks. 
2 lines changed or deleted 9 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)