"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "cinder/tests/unit/volume/drivers/dell_emc/powerstore/test_base.py" between
cinder-17.0.1.tar.gz and cinder-17.1.0.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_base.py  (cinder-17.0.1):test_base.py  (cinder-17.1.0)
skipping to change at line 23 skipping to change at line 23
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
from unittest import mock from unittest import mock
from cinder import exception from cinder import exception
from cinder.tests.unit.volume.drivers.dell_emc import powerstore from cinder.tests.unit.volume.drivers.dell_emc import powerstore
class TestBase(powerstore.TestPowerStoreDriver): class TestBase(powerstore.TestPowerStoreDriver):
@mock.patch("cinder.volume.drivers.dell_emc.powerstore.client." @mock.patch("cinder.volume.drivers.dell_emc.powerstore.client."
"PowerStoreClient.get_chap_config")
@mock.patch("cinder.volume.drivers.dell_emc.powerstore.client."
"PowerStoreClient.get_appliance_id_by_name") "PowerStoreClient.get_appliance_id_by_name")
def test_configuration(self, mock_appliance): def test_configuration(self, mock_appliance, mock_chap):
mock_appliance.return_value = "A1" mock_appliance.return_value = "A1"
self.driver.check_for_setup_error() self.driver.check_for_setup_error()
def test_configuration_rest_parameters_not_set(self): def test_configuration_rest_parameters_not_set(self):
self.driver.adapter.client.rest_ip = None self.driver.adapter.client.rest_ip = None
self.assertRaises(exception.VolumeBackendAPIException, self.assertRaises(exception.VolumeBackendAPIException,
self.driver.check_for_setup_error) self.driver.check_for_setup_error)
def test_configuration_appliances_not_set(self): def test_configuration_appliances_not_set(self):
self.driver.adapter.appliances = {} self.driver.adapter.appliances = {}
skipping to change at line 53 skipping to change at line 55
self.assertIn("not found", error.msg) self.assertIn("not found", error.msg)
@mock.patch("requests.request") @mock.patch("requests.request")
def test_configuration_appliance_bad_status(self, mock_get_request): def test_configuration_appliance_bad_status(self, mock_get_request):
mock_get_request.return_value = powerstore.MockResponse(rc=400) mock_get_request.return_value = powerstore.MockResponse(rc=400)
error = self.assertRaises(exception.VolumeBackendAPIException, error = self.assertRaises(exception.VolumeBackendAPIException,
self.driver.check_for_setup_error) self.driver.check_for_setup_error)
self.assertIn("Failed to query PowerStore appliances.", error.msg) self.assertIn("Failed to query PowerStore appliances.", error.msg)
@mock.patch("cinder.volume.drivers.dell_emc.powerstore.client." @mock.patch("cinder.volume.drivers.dell_emc.powerstore.client."
"PowerStoreClient.get_chap_config")
@mock.patch("cinder.volume.drivers.dell_emc.powerstore.client."
"PowerStoreClient.get_appliance_id_by_name") "PowerStoreClient.get_appliance_id_by_name")
@mock.patch("cinder.volume.drivers.dell_emc.powerstore.client." @mock.patch("cinder.volume.drivers.dell_emc.powerstore.client."
"PowerStoreClient.get_appliance_metrics") "PowerStoreClient.get_appliance_metrics")
def test_update_volume_stats(self, mock_metrics, mock_appliance): def test_update_volume_stats(self,
mock_metrics,
mock_appliance,
mock_chap):
mock_appliance.return_value = "A1" mock_appliance.return_value = "A1"
mock_metrics.return_value = { mock_metrics.return_value = {
"physical_total": 2147483648, "physical_total": 2147483648,
"physical_used": 1073741824, "physical_used": 1073741824,
} }
self.driver.check_for_setup_error() self.driver.check_for_setup_error()
self.driver._update_volume_stats() self.driver._update_volume_stats()
@mock.patch("cinder.volume.drivers.dell_emc.powerstore.client." @mock.patch("cinder.volume.drivers.dell_emc.powerstore.client."
"PowerStoreClient.get_chap_config")
@mock.patch("cinder.volume.drivers.dell_emc.powerstore.client."
"PowerStoreClient.get_appliance_id_by_name") "PowerStoreClient.get_appliance_id_by_name")
@mock.patch("requests.request") @mock.patch("requests.request")
def test_update_volume_stats_bad_status(self, def test_update_volume_stats_bad_status(self,
mock_metrics, mock_metrics,
mock_appliance): mock_appliance,
mock_chap):
mock_appliance.return_value = "A1" mock_appliance.return_value = "A1"
mock_metrics.return_value = powerstore.MockResponse(rc=400) mock_metrics.return_value = powerstore.MockResponse(rc=400)
self.driver.check_for_setup_error() self.driver.check_for_setup_error()
error = self.assertRaises(exception.VolumeBackendAPIException, error = self.assertRaises(exception.VolumeBackendAPIException,
self.driver._update_volume_stats) self.driver._update_volume_stats)
self.assertIn("Failed to query metrics", error.msg) self.assertIn("Failed to query metrics", error.msg)
 End of changes. 6 change blocks. 
3 lines changed or deleted 13 lines changed or added

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