Skip to content

Commit 1ae5cef

Browse files
author
Lucas Gameiro
authored
[DPE-4889] Remove deprecated config option profile-limit-memory (#564)
* remove deprecated config option * update config description * update charm code
1 parent 25bb1ba commit 1ae5cef

File tree

3 files changed

+2
-33
lines changed

3 files changed

+2
-33
lines changed

config.yaml

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -311,20 +311,12 @@ options:
311311
minimal running performance.
312312
type: string
313313
default: production
314-
profile-limit-memory:
315-
type: int
316-
description: |
317-
[DEPRECTATED] Use profile_limit_memory instead. Amount of memory in Megabytes to limit PostgreSQL
318-
and associated process to. If unset, this will be decided according to the default memory limit
319-
in the selected profile. Only comes into effect when the `production` profile is selected. This
320-
config option cannot be set at the same time as profile_limit_memory.
321314
profile_limit_memory:
322315
type: int
323316
description: |
324317
Amount of memory in Megabytes to limit PostgreSQL and associated process to.
325318
If unset, this will be decided according to the default memory limit in the selected profile.
326-
Only comes into effect when the `production` profile is selected. This config option cannot be
327-
set at the same time as profile-limit-memory.
319+
Only comes into effect when the `production` profile is selected.
328320
request_date_style:
329321
description: |
330322
Sets the display format for date and time values. Allowed formats are explained

src/charm.py

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1614,14 +1614,6 @@ def _can_connect_to_postgresql(self) -> bool:
16141614

16151615
def update_config(self, is_creating_backup: bool = False) -> bool:
16161616
"""Updates Patroni config file based on the existence of the TLS files."""
1617-
if (
1618-
self.model.config.get("profile-limit-memory") is not None
1619-
and self.model.config.get("profile_limit_memory") is not None
1620-
):
1621-
raise ValueError(
1622-
"Both profile-limit-memory and profile_limit_memory are set. Please use only one of them."
1623-
)
1624-
16251617
enable_tls = self.is_tls_enabled
16261618
limit_memory = None
16271619
if self.config.profile_limit_memory:

tests/unit/test_charm.py

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1268,26 +1268,11 @@ def test_update_config(harness):
12681268
rel_id = harness.model.get_relation(PEER).id
12691269
# Mock some properties.
12701270
postgresql_mock.is_tls_enabled = PropertyMock(side_effect=[False, False, False, False])
1271-
_is_workload_running.side_effect = [False, False, True, True, False, True]
1271+
_is_workload_running.side_effect = [True, True, False, True]
12721272
_member_started.side_effect = [True, True, False]
12731273
postgresql_mock.build_postgresql_parameters.return_value = {"test": "test"}
12741274

1275-
# Test when only one of the two config options for profile limit memory is set.
1276-
harness.update_config({"profile-limit-memory": 1000})
1277-
harness.charm.update_config()
1278-
1279-
# Test when only one of the two config options for profile limit memory is set.
1280-
harness.update_config({"profile_limit_memory": 1000}, unset={"profile-limit-memory"})
1281-
harness.charm.update_config()
1282-
1283-
# Test when the two config options for profile limit memory are set at the same time.
1284-
_render_patroni_yml_file.reset_mock()
1285-
harness.update_config({"profile-limit-memory": 1000})
1286-
with pytest.raises(ValueError):
1287-
harness.charm.update_config()
1288-
12891275
# Test without TLS files available.
1290-
harness.update_config(unset={"profile-limit-memory", "profile_limit_memory"})
12911276
with harness.hooks_disabled():
12921277
harness.update_relation_data(rel_id, harness.charm.unit.name, {"tls": ""})
12931278
_is_tls_enabled.return_value = False

0 commit comments

Comments
 (0)