Exemplo n.º 1
0
class TestTagIpsetActor(BaseTestCase):
    def setUp(self):
        super(TestTagIpsetActor, self).setUp()
        self.m_ipset = Mock(spec=Ipset)
        self.m_ipset.max_elem = 1234
        self.m_ipset.set_name = "felix-a_set_name"
        self.m_ipset.temp_set_name = "felix-a_set_name-tmp"
        self.tag_ipset = RefCountedIpsetActor("tag-123", "IPv4", max_elem=1024)
        self.tag_ipset._ipset = self.m_ipset
        self.m_mgr = Mock()
        self.tag_ipset._manager = self.m_mgr
        self.tag_ipset._id = "tag-123"

    def test_lifecycle(self):
        self.tag_ipset.replace_members(set(["1.2.3.4"]), async=True)
        self.step_actor(self.tag_ipset)
        self.assertEqual(
            self.m_mgr.on_object_startup_complete.mock_calls,
            [call("tag-123", self.tag_ipset, async=True)]
        )
        self.tag_ipset.on_unreferenced(async=True)
        self.step_actor(self.tag_ipset)
        self.assertEqual(
            self.m_mgr.on_object_cleanup_complete.mock_calls,
            [call("tag-123", self.tag_ipset, async=True)]
        )
Exemplo n.º 2
0
 def setUp(self):
     super(TestTagIpsetActor, self).setUp()
     self.m_ipset = Mock(spec=Ipset)
     self.m_ipset.max_elem = 1234
     self.m_ipset.set_name = "felix-a_set_name"
     self.m_ipset.temp_set_name = "felix-a_set_name-tmp"
     self.tag_ipset = RefCountedIpsetActor("tag-123", "IPv4", max_elem=1024)
     self.tag_ipset._ipset = self.m_ipset
     self.m_mgr = Mock()
     self.tag_ipset._manager = self.m_mgr
     self.tag_ipset._id = "tag-123"
Exemplo n.º 3
0
 def setUp(self):
     super(TestTagIpsetActor, self).setUp()
     self.m_ipset = Mock(spec=Ipset)
     self.m_ipset.max_elem = 1234
     self.m_ipset.set_name = "felix-a_set_name"
     self.m_ipset.temp_set_name = "felix-a_set_name-tmp"
     self.tag_ipset = RefCountedIpsetActor("tag-123", "IPv4", max_elem=1024)
     self.tag_ipset._ipset = self.m_ipset
     self.m_mgr = Mock()
     self.tag_ipset._manager = self.m_mgr
     self.tag_ipset._id = "tag-123"