def testKillNode_NotConnected(self): """Test method for ScalarisVM.killNode() with a closed connection.""" vm = ScalarisVM() vm.close_connection() #self.assertRaises(scalaris.ConnectionError, vm.killNode("test")) vm.killNode("test") vm.close_connection()
def testKillNode_NotConnected(self): """Test method for ScalarisVM.killNode() with a closed connection.""" vm = ScalarisVM() vm.close_connection() #self.assertRaises(scalaris.ConnectionError, vm.killNode("test")) vm.killNode("test") vm.close_connection()
def _testAddNodes(self, nodesToAdd): """Test method for ScalarisVM.addNodes(nodesToAdd).""" vm = ScalarisVM() size = vm.getNumberOfNodes(); (ok, failed) = vm.addNodes(nodesToAdd) size = size + nodesToAdd self.assertEqual(nodesToAdd, len(ok)) self.assertEqual(len(failed), 0) self.assertEqual(size, vm.getNumberOfNodes()) nodes = vm.getNodes() for name in ok: self.assertTrue(name in nodes, str(nodes) + " should contain " + name) for name in ok: vm.killNode(name) size = size - nodesToAdd self.assertEqual(size, vm.getNumberOfNodes()) vm.close_connection()
def _testAddNodes(self, nodesToAdd): """Test method for ScalarisVM.addNodes(nodesToAdd).""" vm = ScalarisVM() size = vm.getNumberOfNodes() (ok, failed) = vm.addNodes(nodesToAdd) size = size + nodesToAdd self.assertEqual(nodesToAdd, len(ok)) self.assertEqual(len(failed), 0) self.assertEqual(size, vm.getNumberOfNodes()) nodes = vm.getNodes() for name in ok: self.assertTrue(name in nodes, str(nodes) + " should contain " + name) for name in ok: vm.killNode(name) size = size - nodesToAdd self.assertEqual(size, vm.getNumberOfNodes()) vm.close_connection()
def _testDeleteNode(self, action): """Test method for ScalarisVM.shutdownNode() and ScalarisVM.killNode().""" vm = ScalarisVM() size = vm.getNumberOfNodes(); (ok, _failed) = vm.addNodes(1) name = ok[0] self.assertEqual(size + 1, vm.getNumberOfNodes()) if action == 'shutdown': result = vm.shutdownNode(name) elif action == 'kill': result = vm.killNode(name) self.assertTrue(result) self.assertEqual(size, vm.getNumberOfNodes()) nodes = vm.getNodes() self.assertTrue(not name in nodes, str(nodes) + " should not contain " + name) vm.close_connection()
def _testDeleteNode(self, action): """Test method for ScalarisVM.shutdownNode() and ScalarisVM.killNode().""" vm = ScalarisVM() size = vm.getNumberOfNodes() (ok, _failed) = vm.addNodes(1) name = ok[0] self.assertEqual(size + 1, vm.getNumberOfNodes()) if action == 'shutdown': result = vm.shutdownNode(name) elif action == 'kill': result = vm.killNode(name) self.assertTrue(result) self.assertEqual(size, vm.getNumberOfNodes()) nodes = vm.getNodes() self.assertTrue(not name in nodes, str(nodes) + " should not contain " + name) vm.close_connection()