Beispiel #1
0
def test_standalone_change_detection():
  master_pid_str = 'master(1)@192.168.33.2:12345'
  master_pid = PID.from_string(master_pid_str)
  detector = StandaloneMasterDetector.from_uri(master_pid_str)
  event = threading.Event()
  future = detector.detect(previous=master_pid)
  future.add_done_callback(lambda f: event.set())
  assert future.running()
  assert not event.is_set()
  detector.appoint(PID.from_string('master(2)@192.168.33.2:12345'))
  event.wait(timeout=1.0)
  assert event.is_set()
Beispiel #2
0
def test_standalone_change_detection():
    master_pid_str = 'master(1)@192.168.33.2:12345'
    master_pid = PID.from_string(master_pid_str)
    detector = StandaloneMasterDetector.from_uri(master_pid_str)
    event = threading.Event()
    future = detector.detect(previous=master_pid)
    future.add_done_callback(lambda f: event.set())
    assert future.running()
    assert not event.is_set()
    detector.appoint(PID.from_string('master(2)@192.168.33.2:12345'))
    event.wait(timeout=1.0)
    assert event.is_set()