canonical / canonical/operator
Higher-level relation testing in unit tests
- Dominant language
- Python
- Stars
- 267
- Forks
- 136
- Avg merge
- 1d 22h
- Merged PRs (30d)
- 28
Description
Some difficulties we face with tests are:
- Integration tests take a long time.
- Scenario tests are too different from juju commands, and difficult to master.
- Charm authors currently do not ship mocks to their libs, so everyone else must roll their own mocks.
- Can't really unit test a bundle - must hand-craft reldata for every relation. But hand-crafting relation data for tests is tedious, brittle and not very readable.
Some mocks we would need to have in place regardless, but I wonder if we could come up with a unit testing API that would solve most of the above.
For example, better match between juju/jubliant methods and unit test methods.
```python
from ops.scenario import Saddle
saddle = Saddle()
# Charm from local path
saddle.deploy("charm1", "./")
# Charm via terraform notation
saddle.deploy("charm2", "https://github.com/canonical/some-k8s-operator//charm-dir?ref=feat/something")
# Same method as jubilant, e.g.
saddle.integrate("charm1", "charm2")
```
Contributor guide
Assessment
This issue has not been assessed yet.