"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "manila/tests/share/drivers/test_service_instance.py" between
manila-8.1.2.tar.gz and manila-8.1.3.tar.gz

About: OpenStack Manila provides “Shared Filesystems as a service”.
The "Stein" series (maintained release).

test_service_instance.py  (manila-8.1.2):test_service_instance.py  (manila-8.1.3)
skipping to change at line 1684 skipping to change at line 1684
instance.teardown_network(dict(foo_id='fake_service_port_id')) instance.teardown_network(dict(foo_id='fake_service_port_id'))
service_instance.neutron.API.router_remove_interface.assert_has_calls( service_instance.neutron.API.router_remove_interface.assert_has_calls(
[]) [])
service_instance.neutron.API.delete_port.assert_has_calls([]) service_instance.neutron.API.delete_port.assert_has_calls([])
service_instance.LOG.debug.assert_has_calls([]) service_instance.LOG.debug.assert_has_calls([])
def test_teardown_network_subnet_is_used(self): def test_teardown_network_subnet_is_used(self):
server_details = dict(subnet_id='foo', router_id='bar') server_details = dict(subnet_id='foo', router_id='bar')
fake_ports = [ fake_ports = [
{'fixed_ips': [{'subnet_id': server_details['subnet_id']}], {'device_id': 'fake_device_id',
'device_id': 'fake_device_id',
'device_owner': 'compute:foo'}, 'device_owner': 'compute:foo'},
] ]
instance = self._init_neutron_network_plugin() instance = self._init_neutron_network_plugin()
self.mock_object( self.mock_object(
service_instance.neutron.API, 'router_remove_interface') service_instance.neutron.API, 'router_remove_interface')
self.mock_object( self.mock_object(
service_instance.neutron.API, 'update_subnet') service_instance.neutron.API, 'update_subnet')
self.mock_object( self.mock_object(
service_instance.neutron.API, 'list_ports', service_instance.neutron.API, 'list_ports',
mock.Mock(return_value=fake_ports)) mock.Mock(return_value=fake_ports))
instance.teardown_network(server_details) instance.teardown_network(server_details)
self.assertFalse( self.assertFalse(
service_instance.neutron.API.router_remove_interface.called) service_instance.neutron.API.router_remove_interface.called)
self.assertFalse(service_instance.neutron.API.update_subnet.called) self.assertFalse(service_instance.neutron.API.update_subnet.called)
service_instance.neutron.API.list_ports.assert_called_once_with( service_instance.neutron.API.list_ports.assert_called_once_with(
fields=['fixed_ips', 'device_id', 'device_owner']) fields=['device_id', 'device_owner'], fixed_ips=['subnet_id=foo'])
def test_teardown_network_subnet_not_used(self): def test_teardown_network_subnet_not_used(self):
server_details = dict(subnet_id='foo', router_id='bar') server_details = dict(subnet_id='foo', router_id='bar')
fake_ports = [ fake_ports = [
{'fixed_ips': [{'subnet_id': server_details['subnet_id']}], {'device_id': 'fake_device_id',
'device_id': 'fake_device_id',
'device_owner': 'network:router_interface'}, 'device_owner': 'network:router_interface'},
{'fixed_ips': [{'subnet_id': 'bar' + server_details['subnet_id']}], {'device_id': 'fake_device_id',
'device_id': 'fake_device_id',
'device_owner': 'compute'}, 'device_owner': 'compute'},
{'fixed_ips': [{'subnet_id': server_details['subnet_id']}], {'device_id': '',
'device_id': '',
'device_owner': 'compute'}, 'device_owner': 'compute'},
] ]
instance = self._init_neutron_network_plugin() instance = self._init_neutron_network_plugin()
self.mock_object( self.mock_object(
service_instance.neutron.API, 'router_remove_interface') service_instance.neutron.API, 'router_remove_interface')
self.mock_object( self.mock_object(
service_instance.neutron.API, 'update_subnet') service_instance.neutron.API, 'update_subnet')
self.mock_object( self.mock_object(
service_instance.neutron.API, 'list_ports', service_instance.neutron.API, 'list_ports',
mock.Mock(return_value=fake_ports)) mock.Mock(return_value=fake_ports))
instance.teardown_network(server_details) instance.teardown_network(server_details)
(service_instance.neutron.API.router_remove_interface. (service_instance.neutron.API.router_remove_interface.
assert_called_once_with('bar', 'foo')) assert_called_once_with('bar', 'foo'))
(service_instance.neutron.API.update_subnet. (service_instance.neutron.API.update_subnet.
assert_called_once_with('foo', '')) assert_called_once_with('foo', ''))
service_instance.neutron.API.list_ports.assert_called_once_with( service_instance.neutron.API.list_ports.assert_called_once_with(
fields=['fixed_ips', 'device_id', 'device_owner']) fields=['device_id', 'device_owner'], fixed_ips=['subnet_id=foo'])
def test_teardown_network_subnet_not_used_and_get_error_404(self): def test_teardown_network_subnet_not_used_and_get_error_404(self):
server_details = dict(subnet_id='foo', router_id='bar') server_details = dict(subnet_id='foo', router_id='bar')
fake_ports = [ fake_ports = [
{'fixed_ips': [{'subnet_id': server_details['subnet_id']}], {'device_id': 'fake_device_id',
'device_id': 'fake_device_id',
'device_owner': 'fake'}, 'device_owner': 'fake'},
] ]
instance = self._init_neutron_network_plugin() instance = self._init_neutron_network_plugin()
self.mock_object( self.mock_object(
service_instance.neutron.API, 'router_remove_interface', service_instance.neutron.API, 'router_remove_interface',
mock.Mock(side_effect=exception.NetworkException(code=404))) mock.Mock(side_effect=exception.NetworkException(code=404)))
self.mock_object( self.mock_object(
service_instance.neutron.API, 'update_subnet') service_instance.neutron.API, 'update_subnet')
self.mock_object( self.mock_object(
service_instance.neutron.API, 'list_ports', service_instance.neutron.API, 'list_ports',
mock.Mock(return_value=fake_ports)) mock.Mock(return_value=fake_ports))
instance.teardown_network(server_details) instance.teardown_network(server_details)
(service_instance.neutron.API.router_remove_interface. (service_instance.neutron.API.router_remove_interface.
assert_called_once_with('bar', 'foo')) assert_called_once_with('bar', 'foo'))
(service_instance.neutron.API.update_subnet. (service_instance.neutron.API.update_subnet.
assert_called_once_with('foo', '')) assert_called_once_with('foo', ''))
service_instance.neutron.API.list_ports.assert_called_once_with( service_instance.neutron.API.list_ports.assert_called_once_with(
fields=['fixed_ips', 'device_id', 'device_owner']) fields=['device_id', 'device_owner'], fixed_ips=['subnet_id=foo'])
def test_teardown_network_subnet_not_used_get_unhandled_error(self): def test_teardown_network_subnet_not_used_get_unhandled_error(self):
server_details = dict(subnet_id='foo', router_id='bar') server_details = dict(subnet_id='foo', router_id='bar')
fake_ports = [ fake_ports = [
{'fixed_ips': [{'subnet_id': server_details['subnet_id']}], {'device_id': 'fake_device_id',
'device_id': 'fake_device_id',
'device_owner': 'fake'}, 'device_owner': 'fake'},
] ]
instance = self._init_neutron_network_plugin() instance = self._init_neutron_network_plugin()
self.mock_object( self.mock_object(
service_instance.neutron.API, 'router_remove_interface', service_instance.neutron.API, 'router_remove_interface',
mock.Mock(side_effect=exception.NetworkException(code=500))) mock.Mock(side_effect=exception.NetworkException(code=500)))
self.mock_object( self.mock_object(
service_instance.neutron.API, 'update_subnet') service_instance.neutron.API, 'update_subnet')
self.mock_object( self.mock_object(
service_instance.neutron.API, 'list_ports', service_instance.neutron.API, 'list_ports',
mock.Mock(return_value=fake_ports)) mock.Mock(return_value=fake_ports))
self.assertRaises( self.assertRaises(
exception.NetworkException, exception.NetworkException,
instance.teardown_network, server_details) instance.teardown_network, server_details)
(service_instance.neutron.API.router_remove_interface. (service_instance.neutron.API.router_remove_interface.
assert_called_once_with('bar', 'foo')) assert_called_once_with('bar', 'foo'))
self.assertFalse(service_instance.neutron.API.update_subnet.called) self.assertFalse(service_instance.neutron.API.update_subnet.called)
service_instance.neutron.API.list_ports.assert_called_once_with( service_instance.neutron.API.list_ports.assert_called_once_with(
fields=['fixed_ips', 'device_id', 'device_owner']) fields=['device_id', 'device_owner'], fixed_ips=['subnet_id=foo'])
def test_setup_network_and_connect_share_server_to_tenant_net(self): def test_setup_network_and_connect_share_server_to_tenant_net(self):
def fake_create_port(*aargs, **kwargs): def fake_create_port(*aargs, **kwargs):
if aargs[1] == 'fake_service_network_id': if aargs[1] == 'fake_service_network_id':
return self.service_port return self.service_port
elif aargs[1] == 'fake_tenant_network_id': elif aargs[1] == 'fake_tenant_network_id':
return self.public_port return self.public_port
else: else:
raise exception.ManilaException('Got unexpected data') raise exception.ManilaException('Got unexpected data')
 End of changes. 10 change blocks. 
16 lines changed or deleted 10 lines changed or added

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