Beispiel #1
0
 def testState(self):
     """ Check if the last changed time is updated when state is changed """
     node = Node(self.manager)
     self.assertEqual(node.getState(), NodeStates.UNKNOWN)
     self.assertTrue(time() - 1 < node.getLastStateChange() < time())
     previous_time = node.getLastStateChange()
     node.setState(NodeStates.RUNNING)
     self.assertEqual(node.getState(), NodeStates.RUNNING)
     self.assertTrue(previous_time < node.getLastStateChange())
     self.assertTrue(time() - 1 < node.getLastStateChange() < time())
Beispiel #2
0
 def testState(self):
     """ Check if the last changed time is updated when state is changed """
     node = Node(self.nm)
     self.assertEqual(node.getState(), NodeStates.DOWN)
     self.assertTrue(time() - 1 < node.getLastStateChange() < time())
     previous_time = node.getLastStateChange()
     node.setState(NodeStates.RUNNING)
     self.assertEqual(node.getState(), NodeStates.RUNNING)
     self.assertTrue(previous_time < node.getLastStateChange())
     self.assertTrue(time() - 1 < node.getLastStateChange() < time())
Beispiel #3
0
 def testInit(self):
     """ Check the node initialization """
     address = ('127.0.0.1', 10000)
     uuid = self.getNewUUID(None)
     node = Node(self.manager, address=address, uuid=uuid)
     self.assertEqual(node.getState(), NodeStates.UNKNOWN)
     self.assertEqual(node.getAddress(), address)
     self.assertEqual(node.getUUID(), uuid)
     self.assertTrue(time() - 1 < node.getLastStateChange() < time())
Beispiel #4
0
 def testInit(self):
     """ Check the node initialization """
     address = ('127.0.0.1', 10000)
     uuid = self.getNewUUID(None)
     node = Node(self.nm, address=address, uuid=uuid)
     self.assertEqual(node.getState(), NodeStates.DOWN)
     self.assertEqual(node.getAddress(), address)
     self.assertEqual(node.getUUID(), uuid)
     self.assertTrue(time() - 1 < node.getLastStateChange() < time())