From d6dcaa695bd8934bc031fd6498b8ca74c9f5a73b Mon Sep 17 00:00:00 2001 From: Dragomir Penev Date: Wed, 24 Sep 2025 19:02:50 +0300 Subject: [PATCH 1/3] Enable smoke test --- tests/integration/ha_tests/test_smoke.py | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/tests/integration/ha_tests/test_smoke.py b/tests/integration/ha_tests/test_smoke.py index 145ff2dbe5d..b9b2049ea1d 100644 --- a/tests/integration/ha_tests/test_smoke.py +++ b/tests/integration/ha_tests/test_smoke.py @@ -5,7 +5,6 @@ import logging import pytest -from juju import tag from pytest_operator.plugin import OpsTest from tenacity import Retrying, stop_after_delay, wait_fixed @@ -143,7 +142,6 @@ async def test_charm_garbage_ignorance(ops_test: OpsTest, charm: str): @pytest.mark.abort_on_fail -@pytest.mark.skip(reason="Unstable") async def test_app_resources_conflicts_v3(ops_test: OpsTest, charm: str): """Test application deploy in dirty environment with garbage storage from another application.""" async with ops_test.fast_forward(): @@ -156,14 +154,17 @@ async def test_app_resources_conflicts_v3(ops_test: OpsTest, charm: str): logger.info(f"Collected storages: {garbage_storages}") logger.info("deploying duplicate application with attached storage") - await ops_test.model.deploy( - charm, - application_name=DUP_DATABASE_APP_NAME, - num_units=1, - base=CHARM_BASE, - attach_storage=[tag.storage(storage) for storage in garbage_storages], - config={"profile": "testing"}, - ) + deploy_cmd = [ + "deploy", + f"./{charm}", + DUP_DATABASE_APP_NAME, + "--model={ops_test.model.info.name}", + "--config profile=testing", + ] + for garbage_storage in garbage_storages: + deploy_cmd.append(f"--attach-storage={garbage_storage}") + return_code, _, _ = await ops_test.juju(*deploy_cmd) + assert return_code == 0, "Failed to add unit with storage" # Reducing the update status frequency to speed up the triggering of deferred events. await ops_test.model.set_config({"update-status-hook-interval": "10s"}) From 90c82f33913da413e131fb49842d28edaeca35cf Mon Sep 17 00:00:00 2001 From: Dragomir Penev Date: Wed, 24 Sep 2025 19:31:04 +0300 Subject: [PATCH 2/3] Attach in one go --- tests/integration/ha_tests/test_smoke.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tests/integration/ha_tests/test_smoke.py b/tests/integration/ha_tests/test_smoke.py index b9b2049ea1d..1f56a054285 100644 --- a/tests/integration/ha_tests/test_smoke.py +++ b/tests/integration/ha_tests/test_smoke.py @@ -160,9 +160,8 @@ async def test_app_resources_conflicts_v3(ops_test: OpsTest, charm: str): DUP_DATABASE_APP_NAME, "--model={ops_test.model.info.name}", "--config profile=testing", + f"--attach-storage={','.join(garbage_storages)}", ] - for garbage_storage in garbage_storages: - deploy_cmd.append(f"--attach-storage={garbage_storage}") return_code, _, _ = await ops_test.juju(*deploy_cmd) assert return_code == 0, "Failed to add unit with storage" From c80170e62a3491008f2ba96bfa63ff80d59b7f53 Mon Sep 17 00:00:00 2001 From: Dragomir Penev Date: Thu, 25 Sep 2025 11:19:28 +0300 Subject: [PATCH 3/3] Log command --- tests/integration/ha_tests/test_smoke.py | 1 + tests/integration/test_subordinates.py | 7 ++++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/tests/integration/ha_tests/test_smoke.py b/tests/integration/ha_tests/test_smoke.py index 1f56a054285..d820249917a 100644 --- a/tests/integration/ha_tests/test_smoke.py +++ b/tests/integration/ha_tests/test_smoke.py @@ -162,6 +162,7 @@ async def test_app_resources_conflicts_v3(ops_test: OpsTest, charm: str): "--config profile=testing", f"--attach-storage={','.join(garbage_storages)}", ] + logger.info(deploy_cmd) return_code, _, _ = await ops_test.juju(*deploy_cmd) assert return_code == 0, "Failed to add unit with storage" diff --git a/tests/integration/test_subordinates.py b/tests/integration/test_subordinates.py index ff6d301e276..c3caeb2d0fe 100644 --- a/tests/integration/test_subordinates.py +++ b/tests/integration/test_subordinates.py @@ -63,11 +63,12 @@ async def test_deploy(ops_test: OpsTest, charm: str, check_subordinate_env_vars) ) await ops_test.model.wait_for_idle(apps=[DATABASE_APP_NAME], status="active", timeout=2000) + await ops_test.model.relate(f"{DATABASE_APP_NAME}:juju-info", f"{LS_CLIENT}:container") await ops_test.model.relate( f"{DATABASE_APP_NAME}:juju-info", f"{UBUNTU_PRO_APP_NAME}:juju-info" ) await ops_test.model.wait_for_idle( - apps=[UBUNTU_PRO_APP_NAME, DATABASE_APP_NAME], status="active" + apps=[LS_CLIENT, UBUNTU_PRO_APP_NAME, DATABASE_APP_NAME], status="active" ) @@ -75,7 +76,7 @@ async def test_scale_up(ops_test: OpsTest, check_subordinate_env_vars): await scale_application(ops_test, DATABASE_APP_NAME, 4) await ops_test.model.wait_for_idle( - apps=[UBUNTU_PRO_APP_NAME, DATABASE_APP_NAME], status="active", timeout=1500 + apps=[LS_CLIENT, UBUNTU_PRO_APP_NAME, DATABASE_APP_NAME], status="active", timeout=1500 ) @@ -83,5 +84,5 @@ async def test_scale_down(ops_test: OpsTest, check_subordinate_env_vars): await scale_application(ops_test, DATABASE_APP_NAME, 3) await ops_test.model.wait_for_idle( - apps=[UBUNTU_PRO_APP_NAME, DATABASE_APP_NAME], status="active", timeout=1500 + apps=[LS_CLIENT, UBUNTU_PRO_APP_NAME, DATABASE_APP_NAME], status="active", timeout=1500 )