Skip to content

Commit 7b7590d

Browse files
authored
[MISC] Remove Sentry test (#554)
* Use jammy haproxy * Remove Sentry test * Lint * Enable test app extension test on Juju 2 * Wait for unit to appear while checking for message * Try livepatch on juju3 * Mark livepatch as unstable
1 parent 67b7634 commit 7b7590d

File tree

2 files changed

+3
-83
lines changed

2 files changed

+3
-83
lines changed

tests/integration/helpers.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -443,7 +443,8 @@ async def deploy_and_relate_bundle_with_postgresql(
443443
if status_message:
444444
awaits.append(
445445
ops_test.model.block_until(
446-
lambda: unit.workload_status_message == status_message, timeout=timeout
446+
lambda: unit.workload_status_message == status_message,
447+
timeout=timeout,
447448
)
448449
)
449450
await asyncio.gather(*awaits)

tests/integration/test_db.py

Lines changed: 1 addition & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66

77
import psycopg2 as psycopg2
88
import pytest as pytest
9-
from juju.errors import JujuUnitError
109
from mailmanclient import Client
1110
from pytest_operator.plugin import OpsTest
1211
from tenacity import Retrying, stop_after_delay, wait_fixed
@@ -22,7 +21,6 @@
2221
check_databases_creation,
2322
deploy_and_relate_application_with_postgresql,
2423
deploy_and_relate_bundle_with_postgresql,
25-
find_unit,
2624
get_leader_unit,
2725
run_command_on_unit,
2826
)
@@ -196,85 +194,6 @@ async def test_relation_data_is_updated_correctly_when_scaling(ops_test: OpsTest
196194
psycopg2.connect(primary_connection_string)
197195

198196

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-
278197
@pytest.mark.group(1)
279198
async def test_roles_blocking(ops_test: OpsTest, charm: str) -> None:
280199
await ops_test.model.deploy(
@@ -333,7 +252,6 @@ async def test_roles_blocking(ops_test: OpsTest, charm: str) -> None:
333252
)
334253

335254

336-
@markers.juju3 # As the Sentry test already checks Juju 2.
337255
@pytest.mark.group(1)
338256
async def test_extensions_blocking(ops_test: OpsTest, charm: str) -> None:
339257
await asyncio.gather(
@@ -377,6 +295,7 @@ async def test_extensions_blocking(ops_test: OpsTest, charm: str) -> None:
377295

378296
@markers.juju2
379297
@pytest.mark.group(1)
298+
@pytest.mark.unstable
380299
@markers.amd64_only # canonical-livepatch-server charm (in bundle) not available for arm64
381300
async def test_canonical_livepatch_onprem_bundle_db(ops_test: OpsTest) -> None:
382301
# Deploy and test the Livepatch onprem bundle (using this PostgreSQL charm

0 commit comments

Comments
 (0)