diff --git a/config.yaml b/config.yaml index 89af90fc71..e9e4d01669 100644 --- a/config.yaml +++ b/config.yaml @@ -311,20 +311,12 @@ options: minimal running performance. type: string default: production - profile-limit-memory: - type: int - description: | - [DEPRECTATED] Use profile_limit_memory instead. Amount of memory in Megabytes to limit PostgreSQL - and associated process to. If unset, this will be decided according to the default memory limit - in the selected profile. Only comes into effect when the `production` profile is selected. This - config option cannot be set at the same time as profile_limit_memory. profile_limit_memory: type: int description: | Amount of memory in Megabytes to limit PostgreSQL and associated process to. If unset, this will be decided according to the default memory limit in the selected profile. - Only comes into effect when the `production` profile is selected. This config option cannot be - set at the same time as profile-limit-memory. + Only comes into effect when the `production` profile is selected. request_date_style: description: | Sets the display format for date and time values. Allowed formats are explained diff --git a/src/charm.py b/src/charm.py index 752e3ec2d9..09c0ae487f 100755 --- a/src/charm.py +++ b/src/charm.py @@ -1614,14 +1614,6 @@ def _can_connect_to_postgresql(self) -> bool: def update_config(self, is_creating_backup: bool = False) -> bool: """Updates Patroni config file based on the existence of the TLS files.""" - if ( - self.model.config.get("profile-limit-memory") is not None - and self.model.config.get("profile_limit_memory") is not None - ): - raise ValueError( - "Both profile-limit-memory and profile_limit_memory are set. Please use only one of them." - ) - enable_tls = self.is_tls_enabled limit_memory = None if self.config.profile_limit_memory: diff --git a/tests/unit/test_charm.py b/tests/unit/test_charm.py index 811ea7490b..2582bc8978 100644 --- a/tests/unit/test_charm.py +++ b/tests/unit/test_charm.py @@ -1268,26 +1268,11 @@ def test_update_config(harness): rel_id = harness.model.get_relation(PEER).id # Mock some properties. postgresql_mock.is_tls_enabled = PropertyMock(side_effect=[False, False, False, False]) - _is_workload_running.side_effect = [False, False, True, True, False, True] + _is_workload_running.side_effect = [True, True, False, True] _member_started.side_effect = [True, True, False] postgresql_mock.build_postgresql_parameters.return_value = {"test": "test"} - # Test when only one of the two config options for profile limit memory is set. - harness.update_config({"profile-limit-memory": 1000}) - harness.charm.update_config() - - # Test when only one of the two config options for profile limit memory is set. - harness.update_config({"profile_limit_memory": 1000}, unset={"profile-limit-memory"}) - harness.charm.update_config() - - # Test when the two config options for profile limit memory are set at the same time. - _render_patroni_yml_file.reset_mock() - harness.update_config({"profile-limit-memory": 1000}) - with pytest.raises(ValueError): - harness.charm.update_config() - # Test without TLS files available. - harness.update_config(unset={"profile-limit-memory", "profile_limit_memory"}) with harness.hooks_disabled(): harness.update_relation_data(rel_id, harness.charm.unit.name, {"tls": ""}) _is_tls_enabled.return_value = False