From 8a7370087880b9f507475324cf774ade741869bd Mon Sep 17 00:00:00 2001 From: Daniela Plascencia Date: Thu, 4 Apr 2024 17:07:37 +0200 Subject: [PATCH] tests: pin deployed charms to a latest and stable compatible version This commit pins all charms that get deployed from Charmhub to a latest/edge or latest/stable version. This commit also refactors the test file so it takes all versions and other constants from a constants.py file Part of canonical/bundle-kubeflow#863 --- tests/test_bundle.py | 31 ++++++++++++++++++++++--------- 1 file changed, 22 insertions(+), 9 deletions(-) diff --git a/tests/test_bundle.py b/tests/test_bundle.py index 42a78d22..ca850541 100644 --- a/tests/test_bundle.py +++ b/tests/test_bundle.py @@ -19,12 +19,22 @@ log = logging.getLogger(__name__) +# Test dependencies DEX_AUTH = "dex-auth" +DEX_AUTH_CHANNEL = "latest/edge" +TRUST_DEX_AUTH = True OIDC_GATEKEEPER = "oidc-gatekeeper" +OIDC_GATEKEEPER_CHANNEL = "latest/edge" +TRUST_OIDC_GATEKEEPER = False +TENSORBOARD_CONTROLLER = "tensorboard-controller" +TENSORBOARD_CONTROLLER_CHANNEL = "latest/edge" +TRUST_TENSORBOARD_CONTROLLER = True +INGRESS_REQUIRER = "kubeflow-volumes" +INGRESS_REQUIRER_CHANNEL = "latest/edge" +TRUST_INGRESS_REQUIRER = False + ISTIO_PILOT = "istio-pilot" ISTIO_GATEWAY_APP_NAME = "istio-ingressgateway" -TENSORBOARD_CONTROLLER = "tensorboard-controller" -KUBEFLOW_VOLUMES = "kubeflow-volumes" USERNAME = "user123" PASSWORD = "user123" @@ -100,9 +110,11 @@ async def test_ingress_relation(ops_test: OpsTest): TODO (https://github.com/canonical/istio-operators/issues/259): Change this from using a specific charm that implements ingress's requirer interface to a generic charm """ - await ops_test.model.deploy(KUBEFLOW_VOLUMES, channel="latest/edge", trust=True) + await ops_test.model.deploy( + INGRESS_REQUIRER, channel=INGRESS_REQUIRER_CHANNEL, trust=TRUST_INGRESS_REQUIRER + ) - await ops_test.model.add_relation(f"{ISTIO_PILOT}:ingress", f"{KUBEFLOW_VOLUMES}:ingress") + await ops_test.model.add_relation(f"{ISTIO_PILOT}:ingress", f"{INGRESS_REQUIRER}:ingress") await ops_test.model.wait_for_idle( status="active", @@ -110,7 +122,7 @@ async def test_ingress_relation(ops_test: OpsTest): timeout=90 * 10, ) - assert_virtualservice_exists(name=KUBEFLOW_VOLUMES, namespace=ops_test.model_name) + assert_virtualservice_exists(name=INGRESS_REQUIRER, namespace=ops_test.model_name) # Confirm that the UI is reachable through the ingress gateway_ip = await get_gateway_ip(ops_test) @@ -123,7 +135,7 @@ async def test_gateway_info_relation(ops_test: OpsTest): TODO (https://github.com/canonical/istio-operators/issues/259): Change this from using a specific charm that implements ingress's requirer interface to a generic charm """ - await ops_test.model.deploy(TENSORBOARD_CONTROLLER, channel="latest/edge", trust=True) + await ops_test.model.deploy(TENSORBOARD_CONTROLLER, channel=TENSORBOARD_CONTROLLER_CHANNEL, trust=TRUST_TENSORBOARD_CONTROLLER) await ops_test.model.add_relation( f"{ISTIO_PILOT}:gateway-info", f"{TENSORBOARD_CONTROLLER}:gateway-info" @@ -234,8 +246,8 @@ async def test_enable_ingress_auth(ops_test: OpsTest): regular_ingress_gateway_ip = await get_gateway_ip(ops_test) await ops_test.model.deploy( DEX_AUTH, - channel="2.31/stable", - trust=True, + channel=DEX_AUTH_CHANNEL, + trust=TRUST_DEX_AUTH, config={ "static-username": USERNAME, "static-password": PASSWORD, @@ -245,7 +257,8 @@ async def test_enable_ingress_auth(ops_test: OpsTest): await ops_test.model.deploy( OIDC_GATEKEEPER, - channel="ckf-1.6/stable", + channel=OIDC_GATEKEEPER_CHANNEL, + trust=TRUST_OIDC_GATEKEEPER, config={"public-url": regular_ingress_gateway_ip}, )