Workaround unittest bug and fix requirements (#1718)

* unittest bug: https://bugs.python.org/issue25532
* `urllib3[secure]` wrongly depends on `ipaddress` for python3, while in fact we don't need all dependencies of the `secure` extra, but only `ipaddress` for the `kubernetes` on python2.7 

Close https://github.com/zalando/patroni/issues/1717
Close https://github.com/zalando/patroni/issues/1709
This commit is contained in:
Alexander Kukushkin
2020-09-29 15:15:58 +02:00
committed by GitHub
parent e2b15eacdf
commit 2c5d62bf10
3 changed files with 14 additions and 10 deletions
+3 -4
View File
@@ -3,7 +3,7 @@ import etcd
import os
import sys
from mock import call, Mock, MagicMock, PropertyMock, patch, mock_open
from mock import Mock, MagicMock, PropertyMock, patch, mock_open
from patroni.config import Config
from patroni.dcs import Cluster, ClusterConfig, Failover, Leader, Member, get_dcs, SyncState, TimelineHistory
from patroni.dcs.etcd import AbstractEtcdClientWithFailover
@@ -902,9 +902,8 @@ class TestHa(PostgresInit):
self.p.pick_synchronous_standby = Mock(return_value=(['other2', 'other3'], ['other2']))
self.ha.dcs.write_sync_state = Mock(return_value=True)
self.ha.run_cycle()
# mock_set_sync.assert_called_once_with(['other2'])
calls = [call(['other2']), call(['other2', 'other3'])]
mock_set_sync.assert_has_calls(calls)
self.assertEqual(mock_set_sync.call_args_list[0][0], (['other2'],))
self.assertEqual(mock_set_sync.call_args_list[1][0], (['other2', 'other3'],))
mock_set_sync.reset_mock()
# Test sync standby is not disabled when updating dcs fails