Skip to content

Commit 796f0d8

Browse files
authored
[MISC] Disable storage test on arm (#872)
* Disable storage test on Arm * Bump libs * Correct import path
1 parent 7d9ec89 commit 796f0d8

File tree

3 files changed

+48
-13
lines changed

3 files changed

+48
-13
lines changed

lib/charms/loki_k8s/v1/loki_push_api.py

Lines changed: 41 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
This document explains how to use the two principal objects this library provides:
1010
1111
- `LokiPushApiProvider`: This object is meant to be used by any Charmed Operator that needs to
12-
implement the provider side of the `loki_push_api` relation interface. For instance, a Loki charm.
12+
implement the provider side of the `loki_push_api` relation interface: for instance, a Loki charm.
1313
The provider side of the relation represents the server side, to which logs are being pushed.
1414
1515
- `LokiPushApiConsumer`: This object is meant to be used by any Charmed Operator that needs to
@@ -533,7 +533,7 @@ def __init__(self, ...):
533533
RelationRole,
534534
WorkloadEvent,
535535
)
536-
from ops.framework import EventBase, EventSource, Object, ObjectEvents
536+
from ops.framework import BoundEvent, EventBase, EventSource, Object, ObjectEvents
537537
from ops.jujuversion import JujuVersion
538538
from ops.model import Container, ModelError, Relation
539539
from ops.pebble import APIError, ChangeError, Layer, PathError, ProtocolError
@@ -546,7 +546,7 @@ def __init__(self, ...):
546546

547547
# Increment this PATCH version before using `charmcraft publish-lib` or reset
548548
# to 0 if you are raising the major API version
549-
LIBPATCH = 13
549+
LIBPATCH = 15
550550

551551
PYDEPS = ["cosl"]
552552

@@ -1543,10 +1543,13 @@ def __init__(
15431543
alert_rules_path: str = DEFAULT_ALERT_RULES_RELATIVE_PATH,
15441544
recursive: bool = False,
15451545
skip_alert_topology_labeling: bool = False,
1546+
*,
1547+
forward_alert_rules: bool = True,
15461548
):
15471549
super().__init__(charm, relation_name)
15481550
self._charm = charm
15491551
self._relation_name = relation_name
1552+
self._forward_alert_rules = forward_alert_rules
15501553
self.topology = JujuTopology.from_charm(charm)
15511554

15521555
try:
@@ -1569,7 +1572,8 @@ def _handle_alert_rules(self, relation):
15691572
alert_rules = (
15701573
AlertRules(None) if self._skip_alert_topology_labeling else AlertRules(self.topology)
15711574
)
1572-
alert_rules.add_path(self._alert_rules_path, recursive=self._recursive)
1575+
if self._forward_alert_rules:
1576+
alert_rules.add_path(self._alert_rules_path, recursive=self._recursive)
15731577
alert_rules_as_dict = alert_rules.as_dict()
15741578

15751579
relation.data[self._charm.app]["metadata"] = json.dumps(self.topology.as_dict())
@@ -1617,6 +1621,9 @@ def __init__(
16171621
alert_rules_path: str = DEFAULT_ALERT_RULES_RELATIVE_PATH,
16181622
recursive: bool = True,
16191623
skip_alert_topology_labeling: bool = False,
1624+
*,
1625+
refresh_event: Optional[Union[BoundEvent, List[BoundEvent]]] = None,
1626+
forward_alert_rules: bool = True,
16201627
):
16211628
"""Construct a Loki charm client.
16221629
@@ -1642,6 +1649,9 @@ def __init__(
16421649
alert_rules_path: a string indicating a path where alert rules can be found
16431650
recursive: Whether to scan for rule files recursively.
16441651
skip_alert_topology_labeling: whether to skip the alert topology labeling.
1652+
forward_alert_rules: a boolean flag to toggle forwarding of charmed alert rules.
1653+
refresh_event: an optional bound event or list of bound events which
1654+
will be observed to re-set scrape job data (IP address and others)
16451655
16461656
Raises:
16471657
RelationNotFoundError: If there is no relation in the charm's metadata.yaml
@@ -1667,14 +1677,26 @@ def __init__(
16671677
charm, relation_name, RELATION_INTERFACE_NAME, RelationRole.requires
16681678
)
16691679
super().__init__(
1670-
charm, relation_name, alert_rules_path, recursive, skip_alert_topology_labeling
1680+
charm,
1681+
relation_name,
1682+
alert_rules_path,
1683+
recursive,
1684+
skip_alert_topology_labeling,
1685+
forward_alert_rules=forward_alert_rules,
16711686
)
16721687
events = self._charm.on[relation_name]
16731688
self.framework.observe(self._charm.on.upgrade_charm, self._on_lifecycle_event)
1689+
self.framework.observe(self._charm.on.config_changed, self._on_lifecycle_event)
16741690
self.framework.observe(events.relation_joined, self._on_logging_relation_joined)
16751691
self.framework.observe(events.relation_changed, self._on_logging_relation_changed)
16761692
self.framework.observe(events.relation_departed, self._on_logging_relation_departed)
16771693

1694+
if refresh_event:
1695+
if not isinstance(refresh_event, list):
1696+
refresh_event = [refresh_event]
1697+
for ev in refresh_event:
1698+
self.framework.observe(ev, self._on_lifecycle_event)
1699+
16781700
def _on_lifecycle_event(self, _: HookEvent):
16791701
"""Update require relation data on charm upgrades and other lifecycle events.
16801702
@@ -2550,10 +2572,17 @@ def __init__(
25502572
alert_rules_path: str = DEFAULT_ALERT_RULES_RELATIVE_PATH,
25512573
recursive: bool = True,
25522574
skip_alert_topology_labeling: bool = False,
2575+
refresh_event: Optional[Union[BoundEvent, List[BoundEvent]]] = None,
2576+
forward_alert_rules: bool = True,
25532577
):
25542578
_PebbleLogClient.check_juju_version()
25552579
super().__init__(
2556-
charm, relation_name, alert_rules_path, recursive, skip_alert_topology_labeling
2580+
charm,
2581+
relation_name,
2582+
alert_rules_path,
2583+
recursive,
2584+
skip_alert_topology_labeling,
2585+
forward_alert_rules=forward_alert_rules,
25572586
)
25582587
self._charm = charm
25592588
self._relation_name = relation_name
@@ -2564,6 +2593,12 @@ def __init__(
25642593
self.framework.observe(on.relation_departed, self._update_logging)
25652594
self.framework.observe(on.relation_broken, self._update_logging)
25662595

2596+
if refresh_event:
2597+
if not isinstance(refresh_event, list):
2598+
refresh_event = [refresh_event]
2599+
for ev in refresh_event:
2600+
self.framework.observe(ev, self._update_logging)
2601+
25672602
for container_name in self._charm.meta.containers.keys():
25682603
snake_case_container_name = container_name.replace("-", "_")
25692604
self.framework.observe(

lib/charms/tempo_coordinator_k8s/v0/tracing.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ def __init__(self, *args):
110110

111111
# Increment this PATCH version before using `charmcraft publish-lib` or reset
112112
# to 0 if you are raising the major API version
113-
LIBPATCH = 5
113+
LIBPATCH = 6
114114

115115
PYDEPS = ["pydantic"]
116116

@@ -129,9 +129,9 @@ def __init__(self, *args):
129129
]
130130

131131
RawReceiver = Tuple[ReceiverProtocol, str]
132-
"""Helper type. A raw receiver is defined as a tuple consisting of the protocol name, and the (external, if available),
133-
(secured, if available) resolvable server url.
134-
"""
132+
# Helper type. A raw receiver is defined as a tuple consisting of the protocol name, and the (external, if available),
133+
# (secured, if available) resolvable server url.
134+
135135

136136
BUILTIN_JUJU_KEYS = {"ingress-address", "private-address", "egress-subnets"}
137137

@@ -150,8 +150,7 @@ class TransportProtocolType(str, enum.Enum):
150150
"jaeger_thrift_http": TransportProtocolType.http,
151151
"jaeger_grpc": TransportProtocolType.grpc,
152152
}
153-
"""A mapping between telemetry protocols and their corresponding transport protocol.
154-
"""
153+
# A mapping between telemetry protocols and their corresponding transport protocol.
155154

156155

157156
class TracingError(Exception):

tests/integration/test_storage.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import pytest
88
from pytest_operator.plugin import OpsTest
99

10+
from . import markers
1011
from .helpers import (
1112
DATABASE_APP_NAME,
1213
STORAGE_PATH,
@@ -17,10 +18,10 @@
1718

1819
logger = logging.getLogger(__name__)
1920

20-
MAX_RETRIES = 20
2121
INSUFFICIENT_SIZE_WARNING = "<10% free space on pgdata volume."
2222

2323

24+
@markers.amd64_only
2425
@pytest.mark.abort_on_fail
2526
async def test_filling_and_emptying_pgdata_storage(ops_test: OpsTest, charm):
2627
"""Build and deploy the charm and saturate its pgdata volume."""

0 commit comments

Comments
 (0)