Skip to content

Commit 0db387a

Browse files
[MISC] Pin grafana-agent-k8s channel to 1/edge (#117)
1 parent 6022cb5 commit 0db387a

File tree

3 files changed

+19
-7
lines changed

3 files changed

+19
-7
lines changed

releases/latest/mysql-k8s-bundle.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ applications:
66
revision: 113
77
scale: 1
88
grafana-agent-k8s:
9-
channel: latest/edge
9+
channel: 1/edge
1010
charm: grafana-agent-k8s
1111
constraints: arch=amd64
1212
resources:

tests/integration/helpers.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,24 @@
11
# Copyright 2023 Canonical Ltd.
22
# See LICENSE file for licensing details.
33

4-
from typing import Dict
4+
from typing import Dict, Optional
55

66
from juju.unit import Unit
77
from pytest_operator.plugin import OpsTest
88

99

10+
async def get_leader_unit(ops_test: OpsTest, app_name: str) -> Optional[Unit]:
11+
"""Get the leader unit of a given application.
12+
13+
Args:
14+
ops_test: The ops test framework instance
15+
app_name: The name of the application
16+
"""
17+
for unit in ops_test.model.applications[app_name].units:
18+
if await unit.is_leader_from_status():
19+
return unit
20+
21+
1022
async def get_unit_ip(ops_test: OpsTest, unit_name: str) -> str:
1123
"""Get unit IP address."""
1224
status = await ops_test.model.get_status()

tests/integration/test_smoke.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
from pytest_operator.plugin import OpsTest
1212

1313
from .connector import MysqlConnector
14-
from .helpers import get_credentials, get_unit_ip
14+
from .helpers import get_credentials, get_leader_unit, get_unit_ip
1515

1616
waiting_apps = [
1717
"mysql-router-k8s",
@@ -91,14 +91,14 @@ async def test_smoke(ops_test: OpsTest) -> None:
9191
await ensure_statuses(ops_test)
9292

9393
logger.info("Confirming data-integrator's database exists")
94-
mysql_unit = ops_test.model.applications["mysql-k8s"].units[0]
95-
mysql_unit_address = await get_unit_ip(ops_test, mysql_unit.name)
96-
server_config_credentials = await get_credentials(mysql_unit, "serverconfig")
94+
mysql_leader = await get_leader_unit(ops_test, "mysql-k8s")
95+
mysql_leader_address = await get_unit_ip(ops_test, mysql_leader.name)
96+
server_config_credentials = await get_credentials(mysql_leader, "serverconfig")
9797

9898
database_config = {
9999
"user": server_config_credentials["username"],
100100
"password": server_config_credentials["password"],
101-
"host": mysql_unit_address,
101+
"host": mysql_leader_address,
102102
"raise_on_warnings": False,
103103
}
104104

0 commit comments

Comments
 (0)