Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request juju#18652 from ycliuhw/implement-model-constraint…
…s-service juju#18652 This PR adds two more domain model service methods for getting and setting model constraints. In the state layer in the next PR, we will ensure that the space you are setting is an existing space, and of course, the model has to exist as well. The constraint logic follows the existing logic from Juju3; it overwrites everything in the database record for each update request(no partial update - merge). This PR proposes the set of functions needed to as part of the model domain to both retrieve and set a model's constraints. This work is very straight forward for the most part following the same logic that we had in Juju 3.x with one exception. Juju has never performed any real validation on the values the user supplies for model constraints opting to save the values verbatim to the database. Now that we have RI in the database there exists cases where validation errors will now pop up around networking spaces not being found and also for container types that are not supported. In addition to this the service will always set a default container type of None when save constraints to the database if the user has not previously set one. This is so that we may have strong RI in the database and avoid double meaning for no container. @wallyworld asked for this change as part of the work. We have made an attempt in this PR as well to start introducing mocks into the service layer for model's. This work will be fully completed and cut over to mocks in an upcoming roadmap task. ## Checklist - [x] Code style: imports ordered, good names, simple structure, etc - [x] Comments saying why design decisions were made - [x] Go unit tests, with comments saying what you're testing - [ ] ~[Integration tests](https://github.com/juju/juju/tree/main/tests), with comments saying what you're testing~ - [ ] ~[doc.go](https://discourse.charmhub.io/t/readme-in-packages/451) added or updated in changed packages~ ## QA steps Unit tests. ## Documentation changes No ## Links **Jira card:** [JUJU-7260](https://warthogs.atlassian.net/browse/JUJU-7260) [JUJU-7260]: https://warthogs.atlassian.net/browse/JUJU-7260?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ
- Loading branch information