"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "sahara/tests/unit/service/test_volumes.py" between
sahara-14.0.0.tar.gz and sahara-15.0.0.tar.gz

About: OpenStack Sahara provides an ability to provision, start, shutdown, scale Hadoop cluster on OpenStack.
The "Xena" series (latest release).

test_volumes.py  (sahara-14.0.0):test_volumes.py  (sahara-15.0.0)
skipping to change at line 18 skipping to change at line 18
# #
# Unless required by applicable law or agreed to in writing, software # Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, # distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
# implied. # implied.
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
from unittest import mock from unittest import mock
from cinderclient.v2 import volumes as vol_v2
from cinderclient.v3 import volumes as vol_v3 from cinderclient.v3 import volumes as vol_v3
from sahara import exceptions as ex from sahara import exceptions as ex
from sahara.service import volumes from sahara.service import volumes
from sahara.tests.unit import base from sahara.tests.unit import base
class TestAttachVolume(base.SaharaWithDbTestCase): class TestAttachVolume(base.SaharaWithDbTestCase):
@mock.patch('sahara.service.engine.Engine.get_node_group_image_username') @mock.patch('sahara.service.engine.Engine.get_node_group_image_username')
def test_mount_volume(self, p_get_username): def test_mount_volume(self, p_get_username):
skipping to change at line 43 skipping to change at line 42
self.assertIsNone(volumes._mount_volume(instance, '123', '456', self.assertIsNone(volumes._mount_volume(instance, '123', '456',
False)) False))
self.assertEqual(3, execute_com.call_count) self.assertEqual(3, execute_com.call_count)
execute_com.side_effect = ex.RemoteCommandException('cmd') execute_com.side_effect = ex.RemoteCommandException('cmd')
self.assertRaises(ex.RemoteCommandException, volumes._mount_volume, self.assertRaises(ex.RemoteCommandException, volumes._mount_volume,
instance, '123', '456', False) instance, '123', '456', False)
@mock.patch('sahara.conductor.manager.ConductorManager.cluster_get') @mock.patch('sahara.conductor.manager.ConductorManager.cluster_get')
@mock.patch('cinderclient.v2.volumes.Volume.delete')
@mock.patch('cinderclient.v2.volumes.Volume.detach')
@mock.patch('sahara.utils.openstack.cinder.get_volume')
def test_detach_volumes_v2(self, p_get_volume, p_detach, p_delete, p_cond):
class Instance(object):
def __init__(self):
self.instance_id = '123454321'
self.volumes = [123]
self.instance_name = 'spam'
instance = Instance()
p_get_volume.return_value = vol_v2.Volume(None, {'id': '123', 'status':
'available'})
p_detach.return_value = None
p_delete.return_value = None
self.assertIsNone(
volumes.detach_from_instance(instance))
@mock.patch('sahara.conductor.manager.ConductorManager.cluster_get')
@mock.patch('cinderclient.v3.volumes.Volume.delete') @mock.patch('cinderclient.v3.volumes.Volume.delete')
@mock.patch('cinderclient.v3.volumes.Volume.detach') @mock.patch('cinderclient.v3.volumes.Volume.detach')
@mock.patch('sahara.utils.openstack.cinder.get_volume') @mock.patch('sahara.utils.openstack.cinder.get_volume')
def test_detach_volumes_v3(self, p_get_volume, p_detach, p_delete, p_cond): def test_detach_volumes_v3(self, p_get_volume, p_detach, p_delete, p_cond):
class Instance(object): class Instance(object):
def __init__(self): def __init__(self):
self.instance_id = '123454321' self.instance_id = '123454321'
self.volumes = [123] self.volumes = [123]
self.instance_name = 'spam' self.instance_name = 'spam'
 End of changes. 2 change blocks. 
20 lines changed or deleted 0 lines changed or added

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