Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: use :memory: as the unit state storage location for ops.testing (…
…#1494) This PR changes Scenario to always use `:memory:` as the location for the unit state database, to speed up running tests. In most cases, the charm root location is a `TemporaryDirectory`, so the unit state database only exists during the event emission anyway. The database could be accessed if a specific root directory was provided (or inside the context manager context) but the correct way to interact with the database is through the State API (deferred events, saved state objects) so we don't want to leave that open for users. Timing (best of 3): |Suite|main|branch| |-|-|-| |operator unit tests (no concurrency)|4m11.923s|3m41.354s| |traefik scenario tests|3m49.479s|1m56.795s| |kafka-k8s-operator scenario tests|0m13.463s|0m13.236s| Note that this [is already the case for Harness](https://github.com/canonical/operator/blob/0ad731a6a9118dfac240e84681f5c41810c4f3f2/ops/_private/harness.py#L309). Refs #1434
- Loading branch information