Skip to content

pebble_check_failed/pebble_check_recovered events always fail consistency check for containers with dashes in their names? #2565

Description

@DnPlas

When testing pebble_check_failed or pebble_check_recovered events for a container whose name contains dashes (e.g. temporal-worker), the consistency checker unconditionally raises InconsistentScenarioError even when the check_infos are correctly set on the container in the state.

I believe that n _consistency_checker.py, all_checks is built using raw container names all_checks = {(c.name, check.name) for c in state.containers for check in c.check_infos}, but evt_container_name (a bit below that) is derived from event.name, which has been normalised.

To reproduce

In a scenario test case:

check_info = ops.testing.CheckInfo("my-check", failures=3, status=ops.pebble.CheckStatus.DOWN)
container = dataclasses.replace(
      state.get_container("temporal-worker"),
      check_infos={check_info},
)
state = dataclasses.replace(state, containers=[container])
context.run(context.on.pebble_check_failed(container, check_info), state) # <-- will raise InconsistentScenarioError

Metadata

Metadata

Labels

rainy daySmall items done in ~10% of each week's timesmall itemA small item, for some value of 'small'testsRelated to tests or testing

Type

No fields configured for Bug.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions