diff --git a/manila/tests/api/v2/test_share_network_subnets.py b/manila/tests/api/v2/test_share_network_subnets.py index 53461f9395..2d7be05e76 100644 --- a/manila/tests/api/v2/test_share_network_subnets.py +++ b/manila/tests/api/v2/test_share_network_subnets.py @@ -286,9 +286,10 @@ class ShareNetworkSubnetControllerTest(test.TestCase): mock_subnet_create.assert_called_once_with( context, fake_data) - @ddt.data({'exception1': exception.ServiceIsDown(), + @ddt.data({'exception1': exception.ServiceIsDown(service='fake_srv'), 'exc_raise': exc.HTTPInternalServerError}, - {'exception1': exception.InvalidShareNetwork(), + {'exception1': exception.InvalidShareNetwork( + reason='fake_reason'), 'exc_raise': exc.HTTPBadRequest}, {'exception1': db_exception.DBError(), 'exc_raise': exc.HTTPInternalServerError}) diff --git a/manila/tests/api/v2/test_share_servers.py b/manila/tests/api/v2/test_share_servers.py index 0e2c56cece..e4b7fbff67 100644 --- a/manila/tests/api/v2/test_share_servers.py +++ b/manila/tests/api/v2/test_share_servers.py @@ -631,9 +631,10 @@ class ShareServerControllerTest(test.TestCase): @ddt.data({'api_exception': exception.ServiceIsDown(service='fake_srv'), 'expected_exception': webob.exc.HTTPBadRequest}, - {'api_exception': exception.InvalidShareServer(reason=""), + {'api_exception': exception.InvalidShareServer( + reason='fake_reason'), 'expected_exception': webob.exc.HTTPConflict}, - {'api_exception': exception.InvalidInput(), + {'api_exception': exception.InvalidInput(reason='fake_reason'), 'expected_exception': webob.exc.HTTPBadRequest}) @ddt.unpack def test__share_server_migration_start_conflict(self, api_exception, diff --git a/manila/tests/share/drivers/netapp/dataontap/cluster_mode/test_lib_base.py b/manila/tests/share/drivers/netapp/dataontap/cluster_mode/test_lib_base.py index c83bdeef85..25d1732a8c 100644 --- a/manila/tests/share/drivers/netapp/dataontap/cluster_mode/test_lib_base.py +++ b/manila/tests/share/drivers/netapp/dataontap/cluster_mode/test_lib_base.py @@ -6018,7 +6018,8 @@ class NetAppFileStorageLibraryTestCase(test.TestCase): mock.Mock(return_value=fake.SHARE_NAME)) self.mock_object( data_motion, 'get_backend_configuration', - mock.Mock(side_effect=exception.BadConfigurationException)) + mock.Mock(side_effect=exception.BadConfigurationException( + reason='fake_reason'))) self.mock_object(self.library, '_get_vserver') mock_exception_log = self.mock_object(lib_base.LOG, 'exception') self.mock_object(share_utils, 'extract_host', mock.Mock( @@ -6058,10 +6059,12 @@ class NetAppFileStorageLibraryTestCase(test.TestCase): @ddt.data( utils.annotated( 'dest_share_server_not_expected', - (('src_vserver', None), exception.InvalidParameterValue)), + (('src_vserver', None), exception.InvalidParameterValue( + err='fake_err'))), utils.annotated( 'src_share_server_not_expected', - (exception.InvalidParameterValue, ('dest_vserver', None)))) + (exception.InvalidParameterValue(err='fake_err'), + ('dest_vserver', None)))) def test_migration_check_compatibility_errors(self, side_effects): self.library._have_cluster_creds = True mock_dm = mock.Mock() diff --git a/manila/tests/share/drivers/quobyte/test_quobyte.py b/manila/tests/share/drivers/quobyte/test_quobyte.py index 27bbf38e82..469962a409 100644 --- a/manila/tests/share/drivers/quobyte/test_quobyte.py +++ b/manila/tests/share/drivers/quobyte/test_quobyte.py @@ -112,7 +112,9 @@ class QuobyteShareDriverTestCase(test.TestCase): @mock.patch('manila.share.drivers.quobyte.jsonrpc.JsonRpc.__init__', mock.Mock(return_value=None)) @mock.patch.object(jsonrpc.JsonRpc, 'call', - side_effect=exception.QBRpcException) + side_effect=exception.QBRpcException( + result='fake_result', + qbcode=666)) def test_do_setup_failure(self, mock_call): self.assertRaises(exception.QBException, self._driver.do_setup, self._context) diff --git a/manila/tests/share/test_api.py b/manila/tests/share/test_api.py index 7f8e2eb21a..e1a7ed2d9a 100644 --- a/manila/tests/share/test_api.py +++ b/manila/tests/share/test_api.py @@ -6863,7 +6863,8 @@ class ShareAPITestCase(test.TestCase): mock.Mock(return_value='fake_update_value')) self.mock_object( self.api, '_share_server_update_allocations_validate_hosts', - mock.Mock(side_effect=exception.InvalidShareNetwork)) + mock.Mock(side_effect=exception.InvalidShareNetwork( + reason='fake_reason'))) mock_delete_data = self.mock_object(self.api.db, 'async_operation_data_delete') diff --git a/manila/tests/share/test_manager.py b/manila/tests/share/test_manager.py index 2305717df7..43f28f3884 100644 --- a/manila/tests/share/test_manager.py +++ b/manila/tests/share/test_manager.py @@ -2051,7 +2051,8 @@ class ShareManagerTestCase(test.TestCase): self.assertEqual(quota_error, mock_exception_log.called) self.assertEqual(expected_exc_count, mock_exception_log.call_count) - @ddt.data(exception.ShareSnapshotIsBusy, exception.ManilaException) + @ddt.data(exception.ShareSnapshotIsBusy(snapshot_name='fake_snapshot'), + exception.ManilaException) def test_delete_snapshot_ignore_exceptions_with_the_force(self, exc): def _raise_quota_error(): @@ -8067,7 +8068,8 @@ class ShareManagerTestCase(test.TestCase): fake_export_locations) @ddt.data(mock.Mock(return_value={'status': constants.STATUS_ERROR}), - mock.Mock(side_effect=exception.ShareBackendException)) + mock.Mock(side_effect=exception.ShareBackendException( + msg='fake_msg'))) def test__update_share_status_share_with_error_or_exception(self, driver_error): instances = self._setup_init_mocks(setup_access_rules=False) @@ -8715,7 +8717,8 @@ class ShareManagerTestCase(test.TestCase): db, 'share_server_get', mock.Mock(return_value=fake_share_server)) mock__server_migration_start_driver = self.mock_object( self.share_manager, '_share_server_migration_start_driver', - mock.Mock(side_effect=exception.ShareServerMigrationFailed)) + mock.Mock(side_effect=exception.ShareServerMigrationFailed( + reason='fake_reason'))) self.share_manager.share_server_migration_start( self.context, fake_share_server['id'], fake_dest_host, writable, @@ -10104,7 +10107,8 @@ class ShareManagerTestCase(test.TestCase): mock.Mock(return_value=snap_instances)) mock_do_update = self.mock_object( self.share_manager, '_do_update_share_server_network_allocations', - mock.Mock(side_effect=exception.AllocationsNotFoundForShareServer)) + mock.Mock(side_effect=exception.AllocationsNotFoundForShareServer( + share_server_id=server_id))) mock_handle_error = self.mock_object( self.share_manager, '_handle_setup_server_error') mock_update_status = self.mock_object(