Example #1
0
    def test_elections_connection(self):

        matchmaker = MockLeader()
        doctor = MockLeader()
        self.store.contend_matchmaker(matchmaker)
        self.store.contend_doctor(doctor)

        matchmaker.wait_running()
        doctor.wait_running()

        # now kill the connection
        self.proxy.stop()
        matchmaker.wait_cancelled(5)
        doctor.wait_cancelled(5)

        # wait for session to expire
        time.sleep(3)

        # start connection back up. leaders should resume. eventually.
        self.proxy.start()

        matchmaker.wait_running(60)
        doctor.wait_running(60)