|
6 | 6 |
|
7 | 7 | import pytest as pytest
|
8 | 8 | from pytest_operator.plugin import OpsTest
|
9 |
| -from tenacity import Retrying, stop_after_attempt, stop_after_delay, wait_exponential |
| 9 | +from tenacity import Retrying, stop_after_attempt, stop_after_delay, wait_exponential, wait_fixed |
10 | 10 |
|
11 | 11 | from . import architecture
|
12 | 12 | from .ha_tests.helpers import (
|
@@ -164,17 +164,21 @@ async def test_tls_enabled(ops_test: OpsTest) -> None:
|
164 | 164 | assert await primary_changed(ops_test, primary), "primary not changed"
|
165 | 165 | change_primary_start_timeout(ops_test, primary, 300)
|
166 | 166 |
|
167 |
| - async with ops_test.fast_forward(): |
168 | 167 | # Check the logs to ensure TLS is being used by pg_rewind.
|
169 | 168 | primary = await get_primary(ops_test, primary)
|
170 |
| - await run_command_on_unit( |
171 |
| - ops_test, |
172 |
| - primary, |
173 |
| - "grep 'connection authorized: user=rewind database=postgres SSL enabled' /var/snap/charmed-postgresql/common/var/log/postgresql/postgresql-*.log", |
174 |
| - ) |
| 169 | + for attempt in Retrying( |
| 170 | + stop=stop_after_attempt(10), wait=wait_fixed(5) |
| 171 | + ): |
| 172 | + with attempt: |
| 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 | + ) |
175 | 178 |
|
176 | 179 | await change_patroni_setting(ops_test, "pause", False, use_random_unit=True, tls=True)
|
177 | 180 |
|
| 181 | + async with ops_test.fast_forward(): |
178 | 182 | # Remove the relation.
|
179 | 183 | await ops_test.model.applications[DATABASE_APP_NAME].remove_relation(
|
180 | 184 | f"{DATABASE_APP_NAME}:certificates", f"{tls_certificates_app_name}:certificates"
|
|
0 commit comments