Skip to content

Commit

Permalink
fix: rebase correction
Browse files Browse the repository at this point in the history
  • Loading branch information
bencekov committed Nov 24, 2023
1 parent 11ec3c7 commit 9c3f993
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 13 deletions.
9 changes: 0 additions & 9 deletions tests/integration/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
from pathlib import Path
from typing import Tuple

import juju.utils
import yaml
from asyncstdlib import functools
from pytest_operator.plugin import OpsTest
Expand All @@ -18,14 +17,6 @@
logger = logging.getLogger(__name__)


async def block_until_leader_elected(ops_test: OpsTest, app_name: str):
async def is_leader_elected():
units = ops_test.model.applications[app_name].units
return any([await units[i].is_leader_from_status() for i in range(len(units))])

await juju.utils.block_until_with_coroutine(is_leader_elected)


@functools.cache
async def grafana_password(ops_test: OpsTest, app_name: str) -> str:
"""Get the admin password . Memoize it to reduce turnaround time.
Expand Down
1 change: 0 additions & 1 deletion tests/integration/oauth_tools/dex.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# Taken from https://github.com/dexidp/dex/blob/master/examples/k8s/dex.yaml
---
apiVersion: v1
kind: Namespace
Expand Down
6 changes: 3 additions & 3 deletions tests/integration/test_grafana_dashboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
get_dashboard_by_search,
get_grafana_dashboards,
oci_image,
block_until_leader_elected,
)

logger = logging.getLogger(__name__)
Expand Down Expand Up @@ -42,8 +41,9 @@ async def test_deploy(ops_test, grafana_charm, grafana_tester_charm):
grafana_tester_charm, resources=tester_resources, application_name=tester_app_name
),
)
await block_until_leader_elected(ops_test, grafana_app_name)
await ops_test.model.wait_for_idle(status="active", timeout=300, idle_period=60)
await ops_test.model.wait_for_idle(
apps=[grafana_app_name, tester_app_name], status="active", wait_for_units=1, timeout=300
)

await check_grafana_is_ready(ops_test, grafana_app_name, 0)
initial_dashboards = await get_grafana_dashboards(ops_test, grafana_app_name, 0)
Expand Down

0 comments on commit 9c3f993

Please sign in to comment.