Example #1
0
    def test_patroni_main(self, mock_machines):
        main()
        sys.argv = ['patroni.py', 'postgres0.yml']

        mock_machines.__get__ = Mock(return_value=['http://remotehost:2379'])
        with patch.object(Patroni, 'run', Mock(side_effect=SleepException())):
            self.assertRaises(SleepException, main)
        with patch.object(Patroni, 'run', Mock(side_effect=KeyboardInterrupt())):
            main()
Example #2
0
    def test_patroni_main(self, mock_machines):
        main()
        sys.argv = ['patroni.py', 'postgres0.yml']

        mock_machines.__get__ = Mock(return_value=['http://remotehost:2379'])
        with patch.object(Patroni, 'run', Mock(side_effect=SleepException())):
            self.assertRaises(SleepException, main)
        with patch.object(Patroni, 'run', Mock(side_effect=KeyboardInterrupt())):
            main()
Example #3
0
    def test_patroni_main(self):
        main()
        sys.argv = ['patroni.py', 'postgres0.yml']
        time.sleep = time_sleep

        with patch.object(Client, 'machines') as mock_machines:
            mock_machines.__get__ = Mock(return_value=['http://remotehost:2379'])
            Patroni.initialize = nop
            touch_member = Patroni.touch_member
            run = Patroni.run

            Patroni.touch_member = self.touch_member
            Patroni.run = time_sleep

            Etcd.delete_leader = nop

            self.assertRaises(Exception, main)

            Patroni.run = run
            Patroni.touch_member = touch_member
Example #4
0
    def test_patroni_main(self):
        main()
        sys.argv = ['patroni.py', 'postgres0.yml']
        time.sleep = time_sleep

        with patch.object(Client, 'machines') as mock_machines:
            mock_machines.__get__ = Mock(
                return_value=['http://remotehost:2379'])
            Patroni.initialize = nop
            touch_member = Patroni.touch_member
            run = Patroni.run

            Patroni.touch_member = self.touch_member
            Patroni.run = time_sleep

            Etcd.delete_leader = nop

            self.assertRaises(Exception, main)

            Patroni.run = run
            Patroni.touch_member = touch_member
Example #5
0
#!/usr/bin/env python
from patroni import main

if __name__ == '__main__':
    main()
Example #6
0
from patroni import main


if __name__ == '__main__':
    main()