Skip to content

Commit 0deadff

Browse files
[LDAP] Uncomment snap service restart
1 parent 7a79674 commit 0deadff

File tree

2 files changed

+7
-11
lines changed

2 files changed

+7
-11
lines changed

src/charm.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2099,11 +2099,7 @@ def update_config(self, is_creating_backup: bool = False) -> bool:
20992099

21002100
self._handle_postgresql_restart_need()
21012101
self._restart_metrics_service()
2102-
2103-
# TODO: Un-comment
2104-
# When PostgreSQL-rock wrapping PostgreSQL-snap versions 162 / 163 gets published
2105-
# (i.e. snap contains https://github.com/canonical/charmed-postgresql-snap/pull/88)
2106-
# self._restart_ldap_sync_service()
2102+
self._restart_ldap_sync_service()
21072103

21082104
return True
21092105

tests/unit/test_charm.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1719,13 +1719,13 @@ def test_update_config(harness):
17191719
)
17201720
_handle_postgresql_restart_need.assert_called_once()
17211721
_restart_metrics_service.assert_called_once()
1722-
# _restart_ldap_sync_service.assert_called_once()
1722+
_restart_ldap_sync_service.assert_called_once()
17231723
assert "tls" not in harness.get_relation_data(rel_id, harness.charm.unit.name)
17241724

17251725
# Test with TLS files available.
17261726
_handle_postgresql_restart_need.reset_mock()
17271727
_restart_metrics_service.reset_mock()
1728-
# _restart_ldap_sync_service.reset_mock()
1728+
_restart_ldap_sync_service.reset_mock()
17291729
harness.update_relation_data(
17301730
rel_id, harness.charm.unit.name, {"tls": ""}
17311731
) # Mock some data in the relation to test that it change.
@@ -1748,7 +1748,7 @@ def test_update_config(harness):
17481748
)
17491749
_handle_postgresql_restart_need.assert_called_once()
17501750
_restart_metrics_service.assert_called_once()
1751-
# _restart_ldap_sync_service.assert_called_once()
1751+
_restart_ldap_sync_service.assert_called_once()
17521752
assert "tls" not in harness.get_relation_data(
17531753
rel_id, harness.charm.unit.name
17541754
) # The "tls" flag is set in handle_postgresql_restart_need.
@@ -1759,11 +1759,11 @@ def test_update_config(harness):
17591759
) # Mock some data in the relation to test that it change.
17601760
_handle_postgresql_restart_need.reset_mock()
17611761
_restart_metrics_service.reset_mock()
1762-
# _restart_ldap_sync_service.reset_mock()
1762+
_restart_ldap_sync_service.reset_mock()
17631763
harness.charm.update_config()
17641764
_handle_postgresql_restart_need.assert_not_called()
17651765
_restart_metrics_service.assert_not_called()
1766-
# _restart_ldap_sync_service.assert_not_called()
1766+
_restart_ldap_sync_service.assert_not_called()
17671767
assert harness.get_relation_data(rel_id, harness.charm.unit.name)["tls"] == "enabled"
17681768

17691769
# Test with member not started yet.
@@ -1773,7 +1773,7 @@ def test_update_config(harness):
17731773
harness.charm.update_config()
17741774
_handle_postgresql_restart_need.assert_not_called()
17751775
_restart_metrics_service.assert_not_called()
1776-
# _restart_ldap_sync_service.assert_not_called()
1776+
_restart_ldap_sync_service.assert_not_called()
17771777
assert "tls" not in harness.get_relation_data(rel_id, harness.charm.unit.name)
17781778

17791779

0 commit comments

Comments
 (0)