Skip to content

Commit

Permalink
tests: remove wait for idle woraround as juju/python-libjuju#900 is f…
Browse files Browse the repository at this point in the history
…ixed (#314)

We used to workaround juju/python-libjuju#900 by addind long waits and asserting the
presence of certain resources before continuing with the test exectuion. Since the issue
is not resolved, we don't need to do this workaround anymore.
Fixes #303
  • Loading branch information
DnPlas authored Aug 17, 2023
1 parent 88c9b98 commit 5bfd81f
Showing 1 changed file with 0 additions and 30 deletions.
30 changes: 0 additions & 30 deletions tests/test_bundle.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,18 +104,12 @@ async def test_ingress_relation(ops_test: OpsTest):

await ops_test.model.add_relation(f"{ISTIO_PILOT}:ingress", f"{KUBEFLOW_VOLUMES}:ingress")

# TODO: This does not wait properly - it should wait for tensorboards_web_app to be active
# and idle. the wait_for_idle print statements say tensorboards-web-app is active/idle, but
# `juju status` reports it is not. As a workaround, all assertions below have a long retry
# period
await ops_test.model.wait_for_idle(
status="active",
raise_on_blocked=False,
timeout=90 * 10,
)

assert_application_and_units_active_idle(ops_test.model.applications[KUBEFLOW_VOLUMES])

assert_virtualservice_exists(name=KUBEFLOW_VOLUMES, namespace=ops_test.model_name)

# Confirm that the UI is reachable through the ingress
Expand Down Expand Up @@ -143,8 +137,6 @@ async def test_gateway_info_relation(ops_test: OpsTest):
idle_period=30, # A hack because sometimes this proceeds without being Active
)

assert_application_and_units_active_idle(ops_test.model.applications[TENSORBOARD_CONTROLLER])


@pytest.mark.abort_on_fail
async def test_deploy_bookinfo_example(ops_test: OpsTest):
Expand Down Expand Up @@ -386,28 +378,6 @@ def assert_url_get(url, allowed_statuses: list, disallowed_statuses: list):
)


# Use a long stop_after_delay period because wait_for_idle is not reliable.
@tenacity.retry(
stop=tenacity.stop_after_delay(600),
wait=tenacity.wait_exponential(multiplier=1, min=1, max=10),
reraise=True,
)
def assert_application_and_units_active_idle(app):
"""Asserts that an applications and its units are all active/idle."""
log.info(f"Asserting that application {app} is active/idle")
log.info(f"Application status: {app.status}")
assert app.status.lower() == "active"

for unit in app.units:
log.info(f"Unit agent_status: {unit.agent_status}")
assert unit.agent_status.lower() == "idle"
log.info(
f"Unit workload_status: {unit.workload_status} with message "
f"'{unit.workload_status_message}'"
)
assert unit.workload_status.lower() == "active"


# Use a long stop_after_delay period because wait_for_idle is not reliable.
@tenacity.retry(
stop=tenacity.stop_after_delay(600),
Expand Down

0 comments on commit 5bfd81f

Please sign in to comment.