Esempio n. 1
0
 def testSetPortsUsed(self):
     agent = self.get_local('agent')
     ports = range(5000, 5010)
     agent.set_ports_used(ports)
     self.assertEqual(agent.get_num_free_ports(), self.NUM_PORTS - 10)
     agent.release_ports(ports)
     self.assertEqual(agent.get_num_free_ports(), self.NUM_PORTS)
Esempio n. 2
0
 def testAllocatePortsAndRelease(self):
     agent = self.get_local('agent')
     ports = yield agent.allocate_ports(10)
     self.assertEqual(agent.get_num_free_ports(), self.NUM_PORTS - 10)
     agent.release_ports(ports)
     self.assertEqual(agent.get_num_free_ports(), self.NUM_PORTS)
Esempio n. 3
0
 def testAllocatePorts(self):
     agent = self.get_local('agent')
     ports = yield agent.allocate_ports(10)
     self.assertEqual(agent.get_num_free_ports(), self.NUM_PORTS - 10)
     self.assertEqual(len(ports), 10)