canonical / ops-scenario

State-transition testing SDK for Operator Framework Juju charms.
Apache License 2.0
10 stars 7 forks source link

Typing improvement: allow iterable in addition to frozenset when constructing state #159

Closed dimaqq closed 1 month ago

dimaqq commented 1 month ago

Today (scenario 7.0 pre), relations= and containers= require frozensets specifically, which I think if an unnecessary burden on folks who write tests.

I think any of these should be allowed:

State(leader=True, relations={ingress, rate_limit}, containers={container})
State(leader=True, relations=[ingress, rate_limit], containers=[container])
State(leader=True, relations=(ingress, rate_limit), containers=(container,))

I find it particularly weird when charm author only has a single item to add, as the syntax for creating a frozenset with a single item requires significant Python experience.