Ejemplo n.º 1
0
 def test_normal(self):
     hb = NodeHeartBeat(interval=0.2)
     hb.add('spa', '1.1.1.1')
     hb.add('spb', '1.1.1.2')
     assert_that(hb.is_available('spa'), equal_to(True))
     assert_that(hb.is_available('spb'), equal_to(True))
     time.sleep(0.5)
     assert_that(hb.is_available('spa'), equal_to(True))
     assert_that(hb.is_available('spb'), equal_to(True))
     hb.stop()
Ejemplo n.º 2
0
 def test_normal(self):
     hb = NodeHeartBeat(interval=0.2)
     hb.add('spa', '1.1.1.1')
     hb.add('spb', '1.1.1.2')
     assert_that(hb.is_available('spa'), equal_to(True))
     assert_that(hb.is_available('spb'), equal_to(True))
     time.sleep(0.5)
     assert_that(hb.is_available('spa'), equal_to(True))
     assert_that(hb.is_available('spb'), equal_to(True))
     hb.stop()
Ejemplo n.º 3
0
 def test_credential_error_no_heart_beat(self):
     hb = NodeHeartBeat(interval=0.01)
     hb.add('spa', '1.1.1.1')
     hb.add('spb', '1.1.1.2')
     assert_that(hb.is_available('spa'), equal_to(True))
     assert_that(hb.is_available('spb'), equal_to(True))
     time.sleep(0.1)
     assert_that(hb.command_count, less_than_or_equal_to(2))
     assert_that(hb.command_count, less_than_or_equal_to(2))
     hb.stop()
Ejemplo n.º 4
0
 def test_credential_error_no_heart_beat(self):
     hb = NodeHeartBeat(interval=0.01)
     hb.add('spa', '1.1.1.1')
     hb.add('spb', '1.1.1.2')
     assert_that(hb.is_available('spa'), equal_to(True))
     assert_that(hb.is_available('spb'), equal_to(True))
     time.sleep(0.1)
     assert_that(hb.command_count, less_than_or_equal_to(2))
     assert_that(hb.command_count, less_than_or_equal_to(2))
     hb.stop()
Ejemplo n.º 5
0
 def test_add(self):
     hb = NodeHeartBeat(interval=0)
     hb.add('spa', '1.1.1.1')
     hb.add('cs', None)
     assert_that(hb.is_available('cs'), equal_to(False))
Ejemplo n.º 6
0
 def test_add(self):
     hb = NodeHeartBeat(interval=0)
     hb.add('spa', '1.1.1.1')
     hb.add('cs', None)
     assert_that(hb.is_available('cs'), equal_to(False))