Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor!: use ops._main._Manager in Scenario #1491

Merged
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 "
tonyandrewmeyer marked this conversation as resolved.
Show resolved Hide resolved
"consistency checks.",
)

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