Skip to content

Commit 7219d1e

Browse files
authored
[MISC] Bump libs and remove TestCase (#622)
* Bump libs * Remove test case asserts * Excessive assert
1 parent 36bac91 commit 7219d1e

File tree

4 files changed

+289
-384
lines changed

4 files changed

+289
-384
lines changed

lib/charms/tempo_k8s/v2/tracing.py

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ def __init__(self, *args):
9797
)
9898
from ops.framework import EventSource, Object
9999
from ops.model import ModelError, Relation
100-
from pydantic import BaseModel, ConfigDict, Field
100+
from pydantic import BaseModel, Field
101101

102102
# The unique Charmhub library identifier, never change it
103103
LIBID = "12977e9aa0b34367903d8afeb8c3d85d"
@@ -107,7 +107,7 @@ def __init__(self, *args):
107107

108108
# Increment this PATCH version before using `charmcraft publish-lib` or reset
109109
# to 0 if you are raising the major API version
110-
LIBPATCH = 8
110+
LIBPATCH = 10
111111

112112
PYDEPS = ["pydantic"]
113113

@@ -338,7 +338,7 @@ class Config:
338338
class ProtocolType(BaseModel):
339339
"""Protocol Type."""
340340

341-
model_config = ConfigDict(
341+
model_config = ConfigDict( # type: ignore
342342
# Allow serializing enum values.
343343
use_enum_values=True
344344
)
@@ -902,7 +902,16 @@ def _get_endpoint(
902902
def get_endpoint(
903903
self, protocol: ReceiverProtocol, relation: Optional[Relation] = None
904904
) -> Optional[str]:
905-
"""Receiver endpoint for the given protocol."""
905+
"""Receiver endpoint for the given protocol.
906+
907+
It could happen that this function gets called before the provider publishes the endpoints.
908+
In such a scenario, if a non-leader unit calls this function, a permission denied exception will be raised due to
909+
restricted access. To prevent this, this function needs to be guarded by the `is_ready` check.
910+
911+
Raises:
912+
ProtocolNotRequestedError:
913+
If the charm unit is the leader unit and attempts to obtain an endpoint for a protocol it did not request.
914+
"""
906915
endpoint = self._get_endpoint(relation or self._relation, protocol=protocol)
907916
if not endpoint:
908917
requested_protocols = set()
@@ -925,7 +934,7 @@ def get_endpoint(
925934
def charm_tracing_config(
926935
endpoint_requirer: TracingEndpointRequirer, cert_path: Optional[Union[Path, str]]
927936
) -> Tuple[Optional[str], Optional[str]]:
928-
"""Utility function to determine the charm_tracing config you will likely want.
937+
"""Return the charm_tracing config you likely want.
929938
930939
If no endpoint is provided:
931940
disable charm tracing.

0 commit comments

Comments
 (0)