diff --git a/src/cluster.py b/src/cluster.py index b9f41be4d4..2774c54f16 100644 --- a/src/cluster.py +++ b/src/cluster.py @@ -846,7 +846,7 @@ def update_synchronous_node_count(self, units: int | None = None) -> None: with attempt: r = requests.patch( f"{self._patroni_url}/config", - json={"synchronous_node_count": units // 2}, + json={"synchronous_node_count": units - 1}, verify=self.verify, auth=self._patroni_auth, timeout=PATRONI_TIMEOUT, diff --git a/tests/integration/helpers.py b/tests/integration/helpers.py index 2d587b38d5..49b88ee3a9 100644 --- a/tests/integration/helpers.py +++ b/tests/integration/helpers.py @@ -1043,7 +1043,6 @@ def switchover( ) assert response.status_code == 200 app_name = current_primary.split("/")[0] - minority_count = len(ops_test.model.applications[app_name].units) // 2 for attempt in Retrying(stop=stop_after_attempt(30), wait=wait_fixed(2), reraise=True): with attempt: response = requests.get(f"http://{primary_ip}:8008/cluster") @@ -1051,7 +1050,7 @@ def switchover( standbys = len([ member for member in response.json()["members"] if member["role"] == "sync_standby" ]) - assert standbys >= minority_count + assert standbys == len(ops_test.model.applications[app_name].units) - 1 async def wait_for_idle_on_blocked(