From 1065917a0cad9857ab8b67937984b22eae640efe Mon Sep 17 00:00:00 2001 From: Orfeas Kourkakis Date: Thu, 21 Nov 2024 17:43:44 +0200 Subject: [PATCH] fix(ci): Use `juju wait-for` instead wait_for_idle() --- requirements-integration-v1.in | 1 + requirements-integration-v1.txt | 2 ++ tests/integration/test_kfp_functional_v1.py | 15 +++++---------- tests/integration/test_kfp_functional_v2.py | 15 ++++----------- 4 files changed, 12 insertions(+), 21 deletions(-) diff --git a/requirements-integration-v1.in b/requirements-integration-v1.in index 619721a9..b4bd6e73 100644 --- a/requirements-integration-v1.in +++ b/requirements-integration-v1.in @@ -11,3 +11,4 @@ pytest pytest-operator pyyaml tenacity +sh diff --git a/requirements-integration-v1.txt b/requirements-integration-v1.txt index 25f9623b..5ba4a321 100644 --- a/requirements-integration-v1.txt +++ b/requirements-integration-v1.txt @@ -272,6 +272,8 @@ rich==13.7.1 # via typer rsa==4.9 # via google-auth +sh==2.1.0 + # via -r requirements-integration-v1.in shellingham==1.5.4 # via typer six==1.16.0 diff --git a/tests/integration/test_kfp_functional_v1.py b/tests/integration/test_kfp_functional_v1.py index d8407e75..1f615a1b 100644 --- a/tests/integration/test_kfp_functional_v1.py +++ b/tests/integration/test_kfp_functional_v1.py @@ -18,6 +18,7 @@ SAMPLE_VIEWER, ) +import sh import kfp import lightkube import pytest @@ -101,16 +102,10 @@ async def test_build_and_deploy(ops_test: OpsTest, request, lightkube_client): # Deploy the kfp-operators bundle from the rendered bundle file await deploy_bundle(ops_test, bundle_path=rendered_bundle, trust=True) - # Wait for everything to be up. Note, at time of writing these charms would naturally go - # into blocked during deploy while waiting for each other to satisfy relations, so we don't - # raise_on_blocked. - await ops_test.model.wait_for_idle( - status="active", - raise_on_blocked=False, # These apps block while waiting for each other to deploy/relate - raise_on_error=True, - timeout=3600, - idle_period=30, - ) + # Use `juju wait-for` instead of `wait_for_idle()` + # due to https://github.com/canonical/kfp-operators/issues/601 + log.info("Waiting on model applications to be active") + sh.juju("wait-for","model","kubeflow", query="forEach(applications, app => app.status == 'active')", timeout="30m") # ---- KFP API Server focused test cases diff --git a/tests/integration/test_kfp_functional_v2.py b/tests/integration/test_kfp_functional_v2.py index ac9db63b..5d32afb8 100644 --- a/tests/integration/test_kfp_functional_v2.py +++ b/tests/integration/test_kfp_functional_v2.py @@ -104,17 +104,10 @@ async def test_build_and_deploy(ops_test: OpsTest, request, lightkube_client): # Deploy the kfp-operators bundle from the rendered bundle file await deploy_bundle(ops_test, bundle_path=rendered_bundle, trust=True) - # Wait for everything to be up. Note, at time of writing these charms would naturally go - # into blocked during deploy while waiting for each other to satisfy relations, so we don't - # raise_on_blocked. - await ops_test.model.wait_for_idle( - status="active", - raise_on_blocked=False, # These apps block while waiting for each other to deploy/relate - raise_on_error=True, - timeout=3600, - idle_period=30, - ) - + # Use `juju wait-for` instead of `wait_for_idle()` + # due to https://github.com/canonical/kfp-operators/issues/601 + log.info("Waiting on model applications to be active") + sh.juju("wait-for","model","kubeflow", query="forEach(applications, app => app.status == 'active')", timeout="30m") # ---- KFP API Server focused test cases async def test_upload_pipeline(kfp_client):