Skip to content

Commit 20ec17e

Browse files
committed
Mover loop_wait restore
1 parent e2b9025 commit 20ec17e

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

tests/integration/test_tls.py

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,10 @@ async def test_tls_enabled(ops_test: OpsTest) -> None:
151151
cursor.execute("INSERT INTO pgrewindtest SELECT generate_series(1,1000);")
152152
connection.close()
153153

154+
await change_patroni_setting(
155+
ops_test, "loop_wait", initial_loop_wait, use_random_unit=True, tls=True
156+
)
157+
154158
# Stop the initial primary by killing both Patroni and PostgreSQL OS processes.
155159
await run_command_on_unit(
156160
ops_test,
@@ -169,16 +173,11 @@ async def test_tls_enabled(ops_test: OpsTest) -> None:
169173

170174
# Check the logs to ensure TLS is being used by pg_rewind.
171175
primary = await get_primary(ops_test, primary)
172-
try:
173-
await run_command_on_unit(
174-
ops_test,
175-
primary,
176-
"grep 'connection authorized: user=rewind database=postgres SSL enabled' /var/snap/charmed-postgresql/common/var/log/postgresql/postgresql-*.log",
177-
)
178-
finally:
179-
await change_patroni_setting(
180-
ops_test, "loop_wait", initial_loop_wait, use_random_unit=True, tls=True
181-
)
176+
await run_command_on_unit(
177+
ops_test,
178+
primary,
179+
"grep 'connection authorized: user=rewind database=postgres SSL enabled' /var/snap/charmed-postgresql/common/var/log/postgresql/postgresql-*.log",
180+
)
182181

183182
# Remove the relation.
184183
await ops_test.model.applications[DATABASE_APP_NAME].remove_relation(

0 commit comments

Comments
 (0)