示例#1
0
 def test_060_network_sfm_secondary_fail(self):
     logging.config.fileConfig("tests/data/test_runner_conf_complete.conf")
     with mock.patch('sys.argv', [self.prog, 'start', '--conf_file=tests/data/test_runner_conf_complete.conf']):
         options = vars(jnt_parse_args())
     stopevent = threading.Event()
     net_state = JNTNetwork(stopevent, JNTOptions(options), is_primary=False, is_secondary=True, do_heartbeat_dispatch=False, test=True)
     net_state.start()
     while net_state.state != 'STARTED':
         net_state.fsm_network_next()
     net_state.fsm_network_fail()
     while net_state.state != 'STARTED':
         net_state.fsm_network_next()
     net_state.fsm_network_recover()
     while net_state.state != 'STARTED':
         net_state.fsm_network_next()
     net_state.stop()
示例#2
0
 def test_120_network_state_secondary_fail(self):
     logging.config.fileConfig("tests/data/test_runner_conf_complete.conf")
     with mock.patch('sys.argv', [self.prog, 'start', '--conf_file=tests/data/test_runner_conf_complete.conf']):
         options = vars(jnt_parse_args())
     stopevent = threading.Event()
     net_state = JNTNetwork(stopevent, JNTOptions(options), is_primary=False, is_secondary=True, do_heartbeat_dispatch=False, resolv_timeout=10)
     print net_state.state
     hadds = { 0 : HADD%(self.add_ctrl,0),
                  }
     net_state.boot(hadds)
     i = 0
     while net_state.state != 'STARTED' and i<150:
         i += 1
         print net_state.state
         time.sleep(1)
     self.assertEqual(net_state.state, 'STARTED')
     net_state.fsm_network_fail()
     print net_state.state
     i = 0
     while net_state.state != 'STARTED' and i<150:
         i += 1
         print net_state.state
         time.sleep(1)
     net_state.fsm_network_recover()
     print net_state.state
     i = 0
     while net_state.state != 'STARTED' and i<150:
         i += 1
         print net_state.state
         time.sleep(1)
     net_state.stop()
     i = 0
     while net_state.state != 'STOPPED' and i<150:
         i += 1
         print net_state.state
         time.sleep(1)
     self.assertEqual(net_state.state, 'STOPPED')