Ejemplo n.º 1
0
 def test_it(self):
     self.client = self.server.createClient()
     self.assertEquals(self.server.MAXIMUM_VMS, 4)
     allocation = self.client.allocate(
         requirements={'node': testlib.defaultRequirement()},
         allocationInfo=testlib.whiteboxAllocationInfo())
     time.sleep(1)
     self.assertFalse(allocation.dead())
     self.assertFalse(allocation.done())
     allocation.free()
 def test_it(self):
     self.client = self.server.createClient()
     self.assertEquals(self.server.MAXIMUM_VMS, 4)
     allocation = self.client.allocate(
         requirements={'node%d' % i: testlib.defaultRequirement()
             for i in xrange(1, self.server.MAXIMUM_VMS + 2)},
         allocationInfo=testlib.whiteboxAllocationInfo())
     before = time.time()
     try:
         allocation.wait(timeout=3)
     except Exception as e:
         self.assertIn('large allocation', str(e).lower())
     else:
         self.assertTrue(False, "allocation should have failed")
     self.assertLess(time.time() - before, 2)
     self.assertIn('large allocation', allocation.dead().lower())
Ejemplo n.º 3
0
 def test_it(self):
     self.client = self.server.createClient()
     self.assertEquals(self.server.MAXIMUM_VMS, 4)
     allocation = self.client.allocate(
         requirements={'node': testlib.defaultRequirement()},
         allocationInfo=testlib.whiteboxAllocationInfo())
     allocation.wait(timeout=5 * 60)
     self.assertFalse(allocation.dead())
     self.assertTrue(allocation.done())
     nodes = allocation.nodes()
     self.assertEquals(len(nodes), 1)
     node = nodes['node']
     ssh = connection.Connection(**node.rootSSHCredentials())
     ssh.waitForTCPServer()
     ssh.connect()
     result = ssh.run.script("echo hello")
     self.assertEquals(result.strip(), "hello")
     allocation.free()
Ejemplo n.º 4
0
 def test_it(self):
     self.client = self.server.createClient()
     self.assertEquals(self.server.MAXIMUM_VMS, 4)
     allocation = self.client.allocate(
         requirements={
             'node%d' % i: testlib.defaultRequirement()
             for i in xrange(1, self.server.MAXIMUM_VMS + 2)
         },
         allocationInfo=testlib.whiteboxAllocationInfo())
     before = time.time()
     try:
         allocation.wait(timeout=3)
     except Exception as e:
         self.assertIn('large allocation', str(e).lower())
     else:
         self.assertTrue(False, "allocation should have failed")
     self.assertLess(time.time() - before, 2)
     self.assertIn('large allocation', allocation.dead().lower())
 def test_it(self):
     self.client = self.server.createClient()
     self.assertEquals(self.server.MAXIMUM_VMS, 4)
     allocation = self.client.allocate(
         requirements={
             'node1': testlib.defaultRequirement(),
             'node2': testlib.defaultRequirement()},
         allocationInfo=testlib.whiteboxAllocationInfo())
     allocation.wait(timeout=8 * 60)
     self.assertFalse(allocation.dead())
     self.assertTrue(allocation.done())
     nodes = allocation.nodes()
     node1 = nodes['node1']
     ssh1 = connection.Connection(**node1.rootSSHCredentials())
     ssh1.waitForTCPServer()
     ssh1.connect()
     self.assertEquals(ssh1.run.script("echo hello"), "hello")
     node2 = nodes['node2']
     ssh2 = connection.Connection(**node2.rootSSHCredentials())
     ssh2.waitForTCPServer()
     ssh2.connect()
     self.assertEquals(ssh2.run.script("echo hello"), "hello")
     allocation.free()
Ejemplo n.º 6
0
 def test_it(self):
     self.client = self.server.createClient()
     self.assertEquals(self.server.MAXIMUM_VMS, 4)
     allocation = self.client.allocate(
         requirements={
             'node1': testlib.defaultRequirement(),
             'node2': testlib.defaultRequirement()
         },
         allocationInfo=testlib.whiteboxAllocationInfo())
     allocation.wait(timeout=8 * 60)
     self.assertFalse(allocation.dead())
     self.assertTrue(allocation.done())
     nodes = allocation.nodes()
     node1 = nodes['node1']
     ssh1 = connection.Connection(**node1.rootSSHCredentials())
     ssh1.waitForTCPServer()
     ssh1.connect()
     self.assertEquals(ssh1.run.script("echo hello"), "hello")
     node2 = nodes['node2']
     ssh2 = connection.Connection(**node2.rootSSHCredentials())
     ssh2.waitForTCPServer()
     ssh2.connect()
     self.assertEquals(ssh2.run.script("echo hello"), "hello")
     allocation.free()