示例#1
0
 def test_configure_tenant_networks_update_fail(self, client_mock,
                                                update_mock,
                                                wait_agent_mock):
     update_mock.side_effect = openstack_exc.OpenStackCloudException(
         message='meow')
     with task_manager.acquire(self.context, self.node.id) as task:
         self.assertRaisesRegex(
             exception.NetworkError, 'Could not add',
             self.interface.configure_tenant_networks, task)
         client_mock.assert_called_once_with(context=task.context)
示例#2
0
 def test__bind_flat_ports_set_binding_host_id_raise(self, update_mock):
     update_mock.side_effect = openstack_exc.OpenStackCloudException()
     internal_info = {'tenant_vif_port_id': 'foo'}
     utils.create_test_port(self.context,
                            node_id=self.node.id,
                            address='52:54:00:cf:2d:33',
                            internal_info=internal_info,
                            uuid=uuidutils.generate_uuid())
     with task_manager.acquire(self.context, self.node.id) as task:
         self.assertRaises(exception.NetworkError,
                           self.interface._bind_flat_ports, task)
示例#3
0
    def test__get_fixed_ip_address_with_exception(self):
        port_id = 'fake-port-id'
        api = dhcp_factory.DHCPFactory().provider

        fake_client = mock.Mock()
        fake_client.get_port.side_effect = (
            openstack_exc.OpenStackCloudException())

        self.assertRaises(exception.NetworkError,
                          api._get_fixed_ip_address, port_id, fake_client)
        fake_client.get_port.assert_called_once_with(port_id)
示例#4
0
    def test_update_port_dhcp_opts_with_exception(self, update_mock,
                                                  client_mock):
        opts = [{}]
        port_id = 'fake-port-id'
        port_data = {
            "id": port_id,
            "fixed_ips": [{
                "ip_address": "192.168.1.3",
            }],
        }
        client_mock.return_value.get_port.return_value = port_data
        update_mock.side_effect = openstack_exc.OpenStackCloudException()

        api = dhcp_factory.DHCPFactory()
        with task_manager.acquire(self.context, self.node.uuid) as task:
            self.assertRaises(exception.FailedToUpdateDHCPOptOnPort,
                              api.provider.update_port_dhcp_opts,
                              port_id,
                              opts,
                              context=task.context)