diff --git a/src/backups.py b/src/backups.py index 084567799a..cbe224c487 100644 --- a/src/backups.py +++ b/src/backups.py @@ -197,7 +197,7 @@ def _empty_data_files(self) -> None: def _change_connectivity_to_database(self, connectivity: bool) -> None: """Enable or disable the connectivity to the database.""" self.charm.unit_peer_data.update({"connectivity": "on" if connectivity else "off"}) - self.charm.update_config() + self.charm.update_config(is_creating_backup=True) def _execute_command( self, command: List[str], timeout: float = None diff --git a/src/charm.py b/src/charm.py index d1389f37d6..1a17f40824 100755 --- a/src/charm.py +++ b/src/charm.py @@ -1410,7 +1410,8 @@ def update_config(self, is_creating_backup: bool = False) -> bool: logger.debug("Early exit update_config: Patroni not started yet") return False - self._validate_config_options() + if not is_creating_backup: + self._validate_config_options() self._patroni.update_parameter_controller_by_patroni( "max_connections", max(4 * available_cpu_cores, 100) diff --git a/tests/integration/helpers.py b/tests/integration/helpers.py index 0ef634241d..0cc71cdac6 100644 --- a/tests/integration/helpers.py +++ b/tests/integration/helpers.py @@ -294,21 +294,6 @@ async def deploy_and_relate_application_with_postgresql( return relation.id -async def enable_connections_logging(ops_test: OpsTest, unit_name: str) -> None: - """Turn on the log of all connections made to a PostgreSQL instance. - - Args: - ops_test: The ops test framework instance - unit_name: The name of the unit to turn on the connection logs - """ - unit_address = await get_unit_address(ops_test, unit_name) - requests.patch( - f"https://{unit_address}:8008/config", - json={"postgresql": {"parameters": {"log_connections": True}}}, - verify=False, - ) - - async def execute_query_on_unit( unit_address: str, password: str, diff --git a/tests/integration/test_tls.py b/tests/integration/test_tls.py index 29919bbe79..1a3b90263d 100644 --- a/tests/integration/test_tls.py +++ b/tests/integration/test_tls.py @@ -17,7 +17,6 @@ check_tls_patroni_api, db_connect, deploy_and_relate_application_with_postgresql, - enable_connections_logging, get_password, get_primary, get_unit_address, @@ -95,7 +94,12 @@ async def test_mattermost_db(ops_test: OpsTest) -> None: # Enable additional logs on the PostgreSQL instance to check TLS # being used in a later step. - await enable_connections_logging(ops_test, primary) + await ops_test.model.applications[DATABASE_APP_NAME].set_config( + {"logging_log_connections": "True"} + ) + await ops_test.model.wait_for_idle( + apps=[DATABASE_APP_NAME], status="active", idle_period=30 + ) for attempt in Retrying(stop=stop_after_delay(60), wait=wait_fixed(2), reraise=True): with attempt: