Skip to content

Commit

Permalink
tests: pin deployed charms to a latest and stable compatible version
Browse files Browse the repository at this point in the history
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
  • Loading branch information
DnPlas committed Apr 15, 2024
1 parent e0d2c02 commit 8a73700
Showing 1 changed file with 22 additions and 9 deletions.
31 changes: 22 additions & 9 deletions tests/test_bundle.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -100,17 +110,19 @@ 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",
raise_on_blocked=False,
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)
Expand All @@ -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"
Expand Down Expand Up @@ -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,
Expand All @@ -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},
)

Expand Down

0 comments on commit 8a73700

Please sign in to comment.