Skip to content

Commit

Permalink
Refactor to use ops._main._Manager.
Browse files Browse the repository at this point in the history
  • Loading branch information
tonyandrewmeyer committed Nov 27, 2024
1 parent eb441f3 commit d8b0a84
Show file tree
Hide file tree
Showing 8 changed files with 222 additions and 435 deletions.
18 changes: 8 additions & 10 deletions testing/src/scenario/_consistency_checker.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
)

from .errors import InconsistentScenarioError
from .runtime import logger as scenario_logger
from ._runtime import logger as scenario_logger
from .state import (
CharmType,
PeerRelation,
Expand Down Expand Up @@ -170,16 +170,14 @@ def check_event_consistency(
errors: List[str] = []
warnings: List[str] = []

# custom event: can't make assumptions about its name and its semantics
# todo: should we then just skip the other checks?
if not event._is_builtin_event(charm_spec):
# This is a custom event - we can't make assumptions about its name and
# semantics. It doesn't really make sense to do checks that are designed
# for relations, workloads, and so on - most likely those will end up
# with false positives. Realistically, we can't know about what the
# requirements for the custom event are (in terms of the state), so we
# skip everything here. Perhaps in the future, custom events could
# optionally include some sort of state metadata that made testing
# consistency possible?
return Results(errors, warnings)
warnings.append(
"this is a custom event; if its name makes it look like a builtin one "
"(e.g. a relation event, or a workload event), you might get some false-negative "
"consistency checks.",
)

if event._is_relation_event:
_check_relation_event(charm_spec, event, state, errors, warnings)
Expand Down
Loading

0 comments on commit d8b0a84

Please sign in to comment.