commit ead798d9ac0d9dbf4b0de7f14fdfe38397790f49 Author: Alexander Kukushkin Date: Mon Jul 18 15:23:55 2022 +0200 Speed up behave tests by always using loop_wait=2 (#2361) run time is reduced from ~5m30s to ~5m diff --git a/features/basic_replication.feature b/features/basic_replication.feature index 3aaeada..2c01a92 100644 --- a/features/basic_replication.feature +++ b/features/basic_replication.feature @@ -5,7 +5,7 @@ Feature: basic replication Given I start postgres0 Then postgres0 is a leader after 10 seconds And there is a non empty initialize key in DCS after 15 seconds - When I issue a PATCH request to http://127.0.0.1:8008/config with {"ttl": 20, "loop_wait": 2, "synchronous_mode": true} + When I issue a PATCH request to http://127.0.0.1:8008/config with {"ttl": 20, "synchronous_mode": true} Then I receive a response code 200 When I start postgres1 And I configure and start postgres2 with a tag replicatefrom postgres0 diff --git a/features/environment.py b/features/environment.py index 3cb1c53..eb30745 100644 --- a/features/environment.py +++ b/features/environment.py @@ -181,7 +181,7 @@ class PatroniController(AbstractController): config['postgresql']['data_dir'] = self._data_dir config['postgresql']['basebackup'] = [{'checkpoint': 'fast'}] config['postgresql']['use_unix_socket'] = os.name != 'nt' # windows doesn't yet support unix-domain sockets - config['postgresql']['use_unix_socket_repl'] = os.name != 'nt' # windows doesn't yet support unix-domain sockets + config['postgresql']['use_unix_socket_repl'] = os.name != 'nt' config['postgresql']['pgpass'] = os.path.join(tempfile.gettempdir(), 'pgpass_' + name) config['postgresql']['parameters'].update({ 'logging_collector': 'on', 'log_destination': 'csvlog', 'log_directory': self._output_dir, @@ -197,7 +197,7 @@ class PatroniController(AbstractController): self.recursive_update(config, custom_config) self.recursive_update(config, { - 'bootstrap': {'dcs': {'postgresql': {'parameters': {'wal_keep_segments': 100}}}}}) + 'bootstrap': {'dcs': {'loop_wait': 2, 'postgresql': {'parameters': {'wal_keep_segments': 100}}}}}) if config['postgresql'].get('callbacks', {}).get('on_role_change'): config['postgresql']['callbacks']['on_role_change'] += ' ' + str(self.__PORT) @@ -626,7 +626,8 @@ class RaftController(AbstractDcsController): self.start() ready_event = threading.Event() - self._raft = KVStoreTTL(ready_event.set, None, None, partner_addrs=[self.CONTROLLER_ADDR], password=self.PASSWORD) + self._raft = KVStoreTTL(ready_event.set, None, None, + partner_addrs=[self.CONTROLLER_ADDR], password=self.PASSWORD) self._raft.startAutoTick() ready_event.wait() diff --git a/features/ignored_slots.feature b/features/ignored_slots.feature index cb6dbf7..abaaef7 100644 --- a/features/ignored_slots.feature +++ b/features/ignored_slots.feature @@ -3,7 +3,7 @@ Feature: ignored slots Given I start postgres1 Then postgres1 is a leader after 10 seconds And there is a non empty initialize key in DCS after 15 seconds - When I issue a PATCH request to http://127.0.0.1:8009/config with {"loop_wait": 2, "ignore_slots": [{"name": "unmanaged_slot_0", "database": "postgres", "plugin": "test_decoding", "type": "logical"}, {"name": "unmanaged_slot_1", "database": "postgres", "plugin": "test_decoding"}, {"name": "unmanaged_slot_2", "database": "postgres"}, {"name": "unmanaged_slot_3"}], "postgresql": {"parameters": {"wal_level": "logical"}}} + When I issue a PATCH request to http://127.0.0.1:8009/config with {"ignore_slots": [{"name": "unmanaged_slot_0", "database": "postgres", "plugin": "test_decoding", "type": "logical"}, {"name": "unmanaged_slot_1", "database": "postgres", "plugin": "test_decoding"}, {"name": "unmanaged_slot_2", "database": "postgres"}, {"name": "unmanaged_slot_3"}], "postgresql": {"parameters": {"wal_level": "logical"}}} Then I receive a response code 200 And Response on GET http://127.0.0.1:8009/config contains ignore_slots after 10 seconds # Make sure the wal_level has been changed. diff --git a/features/patroni_api.feature b/features/patroni_api.feature index 5078ea1..ade9220 100644 --- a/features/patroni_api.feature +++ b/features/patroni_api.feature @@ -35,13 +35,13 @@ Scenario: check local configuration reload Then I receive a response code 202 Scenario: check dynamic configuration change via DCS - Given I run patronictl.py edit-config -s 'ttl=10' -s 'loop_wait=2' -p 'max_connections=101' --force batman + Given I run patronictl.py edit-config -s 'ttl=10' -p 'max_connections=101' --force batman Then I receive a response returncode 0 - And I receive a response output "+loop_wait: 2" + And I receive a response output "+ttl: 10" And Response on GET http://127.0.0.1:8008/patroni contains pending_restart after 11 seconds When I issue a GET request to http://127.0.0.1:8008/config Then I receive a response code 200 - And I receive a response loop_wait 2 + And I receive a response ttl 10 When I issue a GET request to http://127.0.0.1:8008/patroni Then I receive a response code 200 And I receive a response tags {'new_tag': 'new_value'} diff --git a/features/standby_cluster.feature b/features/standby_cluster.feature index 82a800b..5333b5d 100644 --- a/features/standby_cluster.feature +++ b/features/standby_cluster.feature @@ -3,7 +3,7 @@ Feature: standby cluster Given I start postgres1 Then postgres1 is a leader after 10 seconds And there is a non empty initialize key in DCS after 15 seconds - When I issue a PATCH request to http://127.0.0.1:8009/config with {"loop_wait": 2, "slots": {"pm_1": {"type": "physical"}}, "postgresql": {"parameters": {"wal_level": "logical"}}} + When I issue a PATCH request to http://127.0.0.1:8009/config with {"slots": {"pm_1": {"type": "physical"}}, "postgresql": {"parameters": {"wal_level": "logical"}}} Then I receive a response code 200 And Response on GET http://127.0.0.1:8009/config contains slots after 10 seconds And I sleep for 3 seconds