Open ghislainbourgeois opened 1 year ago
I'm hesitant to patch extra names into Container.services because at the moment scenario is using 'native' ops.pebble data structures internally, (Plan, ServiceInfo, etc...) so it'd be unexpected to have a different api in different contexts, when the objects are the same. We could add something to Container:
assert state_out.containers[0].restarted('ausf')
assert state_out.containers[0].replanned
assert state_out.containers[0].sent_signals == ((9, "ausf", "foo"), ("SIGKILL", "bar-server"))
@benhoyt WDYT?
PS in light of #37, probably this kind of container-facing output mocks should end up in scenario.outputs
as they are not quite persisted in the state.
Much like juju-log and action results.
@tonyandrewmeyer perhaps now we're using our own data structures instead of importing them from ops, this becomes more easy to implement in a clean way? will draft something on top of v7 as soon as we release it
There is currently no way in ops-scenario to test a charm interaction with a pebble service, like restarting it for example:
self._container.restart(self._service_name)
.The only way to accomplish this is to mock
ops.model.Container.restart
.It would be nice to have a better way to do this, maybe as an automatic mock in the output state?