Skip to content

state transition testing relation events don't like remote unit zero #2341

@dimaqq

Description

@dimaqq

This test:

    ctx = testing.Context(DummyCharm, meta=META)
    secret = testing.Secret(tracked_content=BAD_SECRET_DATA)
    rel = testing.Relation(
        "rel", "intr",
        remote_app_data={"secret-uri": f'"secret://{secret.id}"'},
        remote_units_data={0: {}},
    )

    state_in = testing.State(relations={rel}, secrets={secret})
    state_out = ctx.run(ctx.on.relation_changed(relation=rel, remote_unit=0), state_in)

Yields ⚠️ WARNING ops-scenario.runtime.consistency_checker:_consistency_checker.py:122 This scenario is probably inconsistent. Double check, and ignore this warning if you're sure. The following warnings were found: 'rel_relation_changed' is implicitly using 0 as the remote unit. Consider passing remote_unit explicitly.

If I change the remote unit to 1 in both remote_units_data=... and remote_unit=... the warning disappears.

I think this means we're confusing the explicit remote unit 1 with the implicit/default.

Given that unit 0 is legal in Juju, we should fix this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    26.10An item we hope to do in the 26.10 cyclerainy daySmall items done in ~10% of each week's timesmall itemA small item, for some value of 'small'

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions