def test_2322(self):
        """Interrupted transition from 2 node cluster to 3 node cluster with replication factor 2"""
        leader = 'a'

        # Node c went away, transition back to 2 node cluster
        self.check_state_transitions(leader=leader, quorum=1, voters=set('bc'),
                                     numsync=1, sync=set('b'), numsync_confirmed=1, active=set('b'),
                                     sync_wanted=1, leader_wanted=leader, expected=[
            ('quorum', leader, 0, set('b')),
        ])

        # Node c is available transition to larger quorum set.
        self.check_state_transitions(leader=leader, quorum=1, voters=set('bc'),
                                     numsync=1, sync=set('b'), numsync_confirmed=1, active=set('bc'),
                                     sync_wanted=1, leader_wanted=leader, expected=[
            ('sync', leader, 1, set('bc')),
        ])

        # Add in a new node at the same time
        self.check_state_transitions(leader=leader, quorum=1, voters=set('bc'),
                                     numsync=1, sync=set('b'), numsync_confirmed=1, active=set('bcd'),
                                     sync_wanted=1, leader_wanted=leader, expected=[
            ('sync', leader, 1, set('bc')),
            ('quorum', leader, 2, set('bcd')),
            ('sync', leader, 1, set('bcd')),
        ])

        # Convert to a fully synced cluster
        self.check_state_transitions(leader=leader, quorum=1, voters=set('bc'),
                                     numsync=1, sync=set('b'), numsync_confirmed=1, active=set('bc'),
                                     sync_wanted=2, leader_wanted=leader, expected=[
            ('sync', leader, 2, set('bc')),
        ])
        # Reduce quorum after all nodes caught up
        self.check_state_transitions(leader=leader, quorum=1, voters=set('bc'),
                                     numsync=2, sync=set('bc'), numsync_confirmed=2, active=set('bc'),
                                     sync_wanted=2, leader_wanted=leader, expected=[
            ('quorum', leader, 0, set('bc')),
        ])
Interrupted transition from 2 node cluster to 3 node cluster with replication factor 2
tests/test_quorum.py