예제 #1
0
 def test_network_partition_fault(self):
     """
     Test that the network partition fault results in a true network partition between nodes.
     """
     self.set_up_trogdor(3)
     spec = NetworkPartitionFaultSpec(0, TaskSpec.MAX_DURATION_MS,
                                         [[self.agent_nodes[0]], self.agent_nodes[1:]])
     partitions = spec.message["partitions"]
     assert 2 == len(partitions)
     assert [self.agent_nodes[0].name] == partitions[0]
     assert [self.agent_nodes[1].name, self.agent_nodes[2].name] == partitions[1]
     self.trogdor.create_task("partition0", spec)
     def verify_nodes_partitioned():
         if node_is_reachable(self.agent_nodes[0], self.agent_nodes[1]):
             return False
         if node_is_reachable(self.agent_nodes[1], self.agent_nodes[0]):
             return False
         if node_is_reachable(self.agent_nodes[2], self.agent_nodes[0]):
             return False
         return True
     wait_until(lambda: verify_nodes_partitioned,
                timeout_sec=10, backoff_sec=.2, err_msg="Failed to verify that the nodes were partitioned.")
     if not node_is_reachable(self.agent_nodes[0], self.agent_nodes[0]):
         raise RuntimeError("Node 0 must be reachable from itself.")
     if not node_is_reachable(self.agent_nodes[1], self.agent_nodes[2]):
         raise RuntimeError("Node 2 must be reachable from node 1.")
     if not node_is_reachable(self.agent_nodes[2], self.agent_nodes[1]):
         raise RuntimeError("Node 1 must be reachable from node 2.")
예제 #2
0
 def verify_nodes_partitioned():
     if node_is_reachable(self.agent_nodes[0], self.agent_nodes[1]):
         return False
     if node_is_reachable(self.agent_nodes[1], self.agent_nodes[0]):
         return False
     if node_is_reachable(self.agent_nodes[2], self.agent_nodes[0]):
         return False
     return True