test_nested_macvlan_vif.py 文件源码

python
阅读 25 收藏 0 点赞 0 评论 0

项目:kuryr-kubernetes 作者: openstack 项目源码 文件源码
def test_release_vif_parent_not_found(self):
        cls = nested_macvlan_vif.NestedMacvlanPodVIFDriver
        m_driver = mock.Mock(spec=cls)
        neutron = self.useFixture(k_fix.MockNeutronClient()).client

        port_id = lib_utils.get_hash()
        pod = mock.sentinel.pod
        vif = mock.Mock()
        vif.id = port_id

        container_mac = mock.sentinel.mac_address
        container_ip = mock.sentinel.ip_address
        container_port = self._get_fake_port(port_id, container_ip,
                                             container_mac)
        neutron.show_port.return_value = container_port

        m_driver.lock = mock.MagicMock(spec=threading.Lock())
        m_driver._get_parent_port.side_effect = n_exc.NeutronClientException

        self.assertRaises(n_exc.NeutronClientException, cls.release_vif,
                          m_driver, pod, vif)
        neutron.show_port.assert_called_once_with(port_id)
        m_driver._get_parent_port.assert_called_once_with(neutron, pod)
        m_driver._remove_from_allowed_address_pairs.assert_not_called()
        neutron.delete_port.assert_not_called()
评论列表


问题


面经


文章

微信
公众号

扫码关注公众号