Fix bug 628 - Better handling of model management 21/7321/1
authorAdam Israel <adam.israel@canonical.com>
Fri, 8 Mar 2019 23:33:35 +0000 (18:33 -0500)
committerAdam Israel <adam.israel@canonical.com>
Thu, 14 Mar 2019 16:33:12 +0000 (12:33 -0400)
In order to address the issue raised in bug 628, we've improved the
handling of how N2VC creates and destroys models. Previously this was
done transparently, but now they are explicit operations that will need
to be performed by the LCM.

The LCM will be required to call `CreateNetworkService()` prior to
calling `DeployCharms`. This will return True if successful, or raise an
exception if the model can't be created.

After LCM has called `RemoveCharms()`, it will need to call
`DestroyNetworkService()` to remove the model from the Juju controller.

- Fix lint errors
- Implement the `DestroyNetworkService` method, which will destroy the
model per Network Service, and any applications deployed to it.
- Adds a new test for creating and deleting models
- Add `CreateNetworkService` to explicitly create a new model for a
Network Service.
- Add proper return values from `logout()` so we can assert against it
during tests
- Add dependency on pytest-assume so we can test multiple failures per
test. This allows us to properly assert and still tear down the juju
client.
- Use pytest.assume. If a method asserts, we can continue with the
teardown of the client.

Change-Id: I3031b008f4ed79f978ecd84ade72e125153729a7
Signed-off-by: Adam Israel <adam.israel@canonical.com>

No differences found