Skip to content

Commit a75bfa2

Browse files
committed
Pause patroni
1 parent 4ff977d commit a75bfa2

File tree

1 file changed

+4
-11
lines changed

1 file changed

+4
-11
lines changed

tests/integration/test_tls.py

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
# See LICENSE file for licensing details.
44
import logging
55
import os
6-
from asyncio import sleep
76

87
import pytest as pytest
98
from pytest_operator.plugin import OpsTest
@@ -12,7 +11,6 @@
1211
from . import architecture
1312
from .ha_tests.helpers import (
1413
change_patroni_setting,
15-
get_patroni_setting,
1614
)
1715
from .helpers import (
1816
CHARM_SERIES,
@@ -111,11 +109,8 @@ async def test_tls_enabled(ops_test: OpsTest) -> None:
111109
)
112110
change_primary_start_timeout(ops_test, primary, 0)
113111

114-
# Change the loop wait setting to make Patroni wait more time before restarting PostgreSQL.
115-
initial_loop_wait = await get_patroni_setting(ops_test, "loop_wait", tls=True)
116-
await change_patroni_setting(ops_test, "loop_wait", 300, use_random_unit=True, tls=True)
117-
118-
await sleep(2 * initial_loop_wait)
112+
# Pause Patroni so it doesn't wipe the custom changes
113+
await change_patroni_setting(ops_test, "pause", True, use_random_unit=True, tls=True)
119114

120115
for attempt in Retrying(
121116
stop=stop_after_delay(60 * 5), wait=wait_exponential(multiplier=1, min=2, max=30)
@@ -151,10 +146,6 @@ async def test_tls_enabled(ops_test: OpsTest) -> None:
151146
cursor.execute("INSERT INTO pgrewindtest SELECT generate_series(1,1000);")
152147
connection.close()
153148

154-
await change_patroni_setting(
155-
ops_test, "loop_wait", initial_loop_wait, use_random_unit=True, tls=True
156-
)
157-
158149
# Stop the initial primary by killing both Patroni and PostgreSQL OS processes.
159150
await run_command_on_unit(
160151
ops_test,
@@ -179,6 +170,8 @@ async def test_tls_enabled(ops_test: OpsTest) -> None:
179170
"grep 'connection authorized: user=rewind database=postgres SSL enabled' /var/snap/charmed-postgresql/common/var/log/postgresql/postgresql-*.log",
180171
)
181172

173+
await change_patroni_setting(ops_test, "pause", False, use_random_unit=True, tls=True)
174+
182175
# Remove the relation.
183176
await ops_test.model.applications[DATABASE_APP_NAME].remove_relation(
184177
f"{DATABASE_APP_NAME}:certificates", f"{tls_certificates_app_name}:certificates"

0 commit comments

Comments
 (0)