|
6 | 6 |
|
7 | 7 | import psycopg2 as psycopg2
|
8 | 8 | import pytest as pytest
|
9 |
| -from juju.errors import JujuUnitError |
10 | 9 | from mailmanclient import Client
|
11 | 10 | from pytest_operator.plugin import OpsTest
|
12 | 11 | from tenacity import Retrying, stop_after_delay, wait_fixed
|
|
22 | 21 | check_databases_creation,
|
23 | 22 | deploy_and_relate_application_with_postgresql,
|
24 | 23 | deploy_and_relate_bundle_with_postgresql,
|
25 |
| - find_unit, |
26 | 24 | get_leader_unit,
|
27 | 25 | run_command_on_unit,
|
28 | 26 | )
|
@@ -196,85 +194,6 @@ async def test_relation_data_is_updated_correctly_when_scaling(ops_test: OpsTest
|
196 | 194 | psycopg2.connect(primary_connection_string)
|
197 | 195 |
|
198 | 196 |
|
199 |
| -@markers.juju2 |
200 |
| -@pytest.mark.group(1) |
201 |
| -@markers.amd64_only # sentry snap not available for arm64 |
202 |
| -async def test_sentry_db_blocked(ops_test: OpsTest, charm: str) -> None: |
203 |
| - async with ops_test.fast_forward(): |
204 |
| - # Deploy Sentry and its dependencies. |
205 |
| - await asyncio.gather( |
206 |
| - ops_test.model.deploy( |
207 |
| - "omnivector-sentry", application_name="sentry1", series="bionic" |
208 |
| - ), |
209 |
| - ops_test.model.deploy("haproxy", series="focal"), |
210 |
| - ops_test.model.deploy("omnivector-redis", application_name="redis", series="bionic"), |
211 |
| - ) |
212 |
| - await ops_test.model.wait_for_idle( |
213 |
| - apps=["sentry1"], |
214 |
| - status="blocked", |
215 |
| - raise_on_blocked=False, |
216 |
| - timeout=1000, |
217 |
| - ) |
218 |
| - await asyncio.gather( |
219 |
| - ops_test.model.relate("sentry1", "redis"), |
220 |
| - ops_test.model.relate("sentry1", f"{DATABASE_APP_NAME}:db"), |
221 |
| - ops_test.model.relate("sentry1", "haproxy"), |
222 |
| - ) |
223 |
| - |
224 |
| - # Only the leader will block |
225 |
| - leader_unit = await find_unit(ops_test, DATABASE_APP_NAME, True) |
226 |
| - |
227 |
| - try: |
228 |
| - await ops_test.model.wait_for_idle( |
229 |
| - apps=[DATABASE_APP_NAME], |
230 |
| - status="blocked", |
231 |
| - raise_on_blocked=True, |
232 |
| - timeout=1000, |
233 |
| - ) |
234 |
| - assert False, "Leader didn't block" |
235 |
| - except JujuUnitError: |
236 |
| - pass |
237 |
| - |
238 |
| - assert leader_unit.workload_status_message == EXTENSIONS_BLOCKING_MESSAGE |
239 |
| - |
240 |
| - # Verify that the charm unblocks when the extensions are enabled after being blocked |
241 |
| - # due to disabled extensions. |
242 |
| - logger.info("Verifying that the charm unblocks when the extensions are enabled") |
243 |
| - config = {"plugin_citext_enable": "True"} |
244 |
| - await ops_test.model.applications[DATABASE_APP_NAME].set_config(config) |
245 |
| - await ops_test.model.wait_for_idle( |
246 |
| - apps=[DATABASE_APP_NAME, "sentry1"], |
247 |
| - status="active", |
248 |
| - raise_on_blocked=False, |
249 |
| - idle_period=15, |
250 |
| - ) |
251 |
| - |
252 |
| - # Verify that the charm doesn't block when the extensions are enabled |
253 |
| - # (another sentry deployment is used because it doesn't request a database |
254 |
| - # again after the relation with the PostgreSQL charm is destroyed and reestablished). |
255 |
| - logger.info("Verifying that the charm doesn't block when the extensions are enabled") |
256 |
| - await asyncio.gather( |
257 |
| - ops_test.model.remove_application("sentry1", block_until_done=True), |
258 |
| - ops_test.model.deploy( |
259 |
| - "omnivector-sentry", application_name="sentry2", series="bionic" |
260 |
| - ), |
261 |
| - ) |
262 |
| - await asyncio.gather( |
263 |
| - ops_test.model.relate("sentry2", "redis"), |
264 |
| - ops_test.model.relate("sentry2", f"{DATABASE_APP_NAME}:db"), |
265 |
| - ops_test.model.relate("sentry2", "haproxy"), |
266 |
| - ) |
267 |
| - await ops_test.model.wait_for_idle( |
268 |
| - apps=[DATABASE_APP_NAME, "sentry2"], status="active", raise_on_blocked=False |
269 |
| - ) |
270 |
| - |
271 |
| - await asyncio.gather( |
272 |
| - ops_test.model.remove_application("redis", block_until_done=True), |
273 |
| - ops_test.model.remove_application("sentry2", block_until_done=True), |
274 |
| - ops_test.model.remove_application("haproxy", block_until_done=True), |
275 |
| - ) |
276 |
| - |
277 |
| - |
278 | 197 | @pytest.mark.group(1)
|
279 | 198 | async def test_roles_blocking(ops_test: OpsTest, charm: str) -> None:
|
280 | 199 | await ops_test.model.deploy(
|
@@ -333,7 +252,6 @@ async def test_roles_blocking(ops_test: OpsTest, charm: str) -> None:
|
333 | 252 | )
|
334 | 253 |
|
335 | 254 |
|
336 |
| -@markers.juju3 # As the Sentry test already checks Juju 2. |
337 | 255 | @pytest.mark.group(1)
|
338 | 256 | async def test_extensions_blocking(ops_test: OpsTest, charm: str) -> None:
|
339 | 257 | await asyncio.gather(
|
@@ -377,6 +295,7 @@ async def test_extensions_blocking(ops_test: OpsTest, charm: str) -> None:
|
377 | 295 |
|
378 | 296 | @markers.juju2
|
379 | 297 | @pytest.mark.group(1)
|
| 298 | +@pytest.mark.unstable |
380 | 299 | @markers.amd64_only # canonical-livepatch-server charm (in bundle) not available for arm64
|
381 | 300 | async def test_canonical_livepatch_onprem_bundle_db(ops_test: OpsTest) -> None:
|
382 | 301 | # Deploy and test the Livepatch onprem bundle (using this PostgreSQL charm
|
|
0 commit comments