Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions src/charm.py
Original file line number Diff line number Diff line change
Expand Up @@ -1070,11 +1070,7 @@ def _on_install(self, event: InstallEvent) -> None:
self.unit.status = MaintenanceStatus("installing PostgreSQL")

# Install the charmed PostgreSQL snap.
try:
self._install_snap_packages(packages=SNAP_PACKAGES)
except snap.SnapError:
self.unit.status = BlockedStatus("failed to install snap packages")
return
self._install_snap_packages(packages=SNAP_PACKAGES)

cache = snap.SnapCache()
postgres_snap = cache[POSTGRESQL_SNAP_NAME]
Expand Down
16 changes: 0 additions & 16 deletions tests/unit/test_charm.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,22 +134,6 @@ def test_on_install_failed_to_create_home(harness):
assert isinstance(harness.model.unit.status, WaitingStatus)


def test_on_install_snap_failure(harness):
with (
patch("charm.PostgresqlOperatorCharm._install_snap_packages") as _install_snap_packages,
patch(
"charm.PostgresqlOperatorCharm._is_storage_attached", return_value=True
) as _is_storage_attached,
):
# Mock the result of the call.
_install_snap_packages.side_effect = snap.SnapError
# Trigger the hook.
harness.charm.on.install.emit()
# Assert that the needed calls were made.
_install_snap_packages.assert_called_once()
assert isinstance(harness.model.unit.status, BlockedStatus)


def test_patroni_scrape_config_no_tls(harness):
result = harness.charm.patroni_scrape_config()

Expand Down