From 207992e95a9da322ef0b382f1938fdd62f37b9c0 Mon Sep 17 00:00:00 2001 From: Leon <82407168+sed-i@users.noreply.github.com> Date: Mon, 20 Mar 2023 19:48:31 +0200 Subject: [PATCH] Fix some itests (#454) * Add missing await, drop metallb reinit --- tests/integration/test_external_url.py | 28 +++----------------------- 1 file changed, 3 insertions(+), 25 deletions(-) diff --git a/tests/integration/test_external_url.py b/tests/integration/test_external_url.py index 4a640909..5ef335b9 100644 --- a/tests/integration/test_external_url.py +++ b/tests/integration/test_external_url.py @@ -18,7 +18,7 @@ import urllib.request import pytest -from helpers import oci_image, uk8s_group, unit_address +from helpers import oci_image, unit_address from pytest_operator.plugin import OpsTest from workload import Prometheus @@ -111,7 +111,7 @@ async def get_ingressed_endpoints(): ingressed_endpoints = await get_ingressed_endpoints() logger.debug("Waiting for endpoints to become reachable: %s", ingressed_endpoints) await ops_test.model.block_until( - lambda: all(Prometheus(ep).is_ready() for ep in ingressed_endpoints) + lambda: all(await Prometheus(ep).is_ready() for ep in ingressed_endpoints) ) @@ -131,8 +131,7 @@ async def force_update_status(ops_test: OpsTest): @pytest.mark.xfail async def test_jobs_are_up_via_traefik(ops_test: OpsTest): - # Set up microk8s metallb addon, needed by traefik - logger.info("(Re)-enabling metallb") + # Assuming metallb is already enabled cmd = [ "sh", "-c", @@ -141,27 +140,6 @@ async def test_jobs_are_up_via_traefik(ops_test: OpsTest): result = subprocess.run(cmd, check=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) ip = result.stdout.decode("utf-8").strip() - logger.info("First, disable metallb, just in case") - try: - cmd = ["sg", uk8s_group(), "-c", "microk8s disable metallb"] - subprocess.run(cmd, check=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) - except Exception as e: - print(e) - raise - - await asyncio.sleep(30) # why? just because, for now - - logger.info("Now enable metallb") - try: - cmd = ["sg", uk8s_group(), "-c", f"microk8s enable metallb:{ip}-{ip}"] - subprocess.run(cmd, check=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) - except Exception as e: - print(e) - raise - - # GIVEN metallb is ready - await asyncio.sleep(30) # why? just because, for now - # WHEN prometheus is related to traefik await ops_test.model.add_relation(f"{prometheus_app_name}:ingress", "traefik")