diff --git a/src/upgrade.py b/src/upgrade.py index 3c9d653a75..ef69e5ac49 100644 --- a/src/upgrade.py +++ b/src/upgrade.py @@ -126,6 +126,10 @@ def _on_upgrade_charm_check_legacy(self) -> None: @override def _on_upgrade_granted(self, event: UpgradeGrantedEvent) -> None: # Refresh the charmed PostgreSQL snap and restart the database. + # Update the configuration. + self.charm.unit.status = MaintenanceStatus("updating configuration") + self.charm.update_config() + self.charm.unit.status = MaintenanceStatus("refreshing the snap") self.charm._install_snap_packages(packages=SNAP_PACKAGES, refresh=True) diff --git a/tests/unit/test_upgrade.py b/tests/unit/test_upgrade.py index 9402ad1295..dd584f2899 100644 --- a/tests/unit/test_upgrade.py +++ b/tests/unit/test_upgrade.py @@ -62,8 +62,10 @@ def test_log_rollback(self, mock_logging, _update_config): @patch("charm.PostgresqlOperatorCharm._setup_exporter") @patch("charm.Patroni.start_patroni") @patch("charm.PostgresqlOperatorCharm._install_snap_packages") + @patch("charm.PostgresqlOperatorCharm.update_config") def test_on_upgrade_granted( self, + _update_config, _install_snap_packages, _start_patroni, _setup_exporter, @@ -80,6 +82,7 @@ def test_on_upgrade_granted( mock_event = MagicMock() _start_patroni.return_value = False self.charm.upgrade._on_upgrade_granted(mock_event) + _update_config.assert_called_once() _install_snap_packages.assert_called_once_with(packages=SNAP_PACKAGES, refresh=True) _member_started.assert_not_called() mock_event.defer.assert_not_called()