* Add calls to asyncio.get_event_loop().close() to close loop. libjuju does
not do this for you and needs to be done just before exiting.
* Require model to be explicitly set when running command line tools. This is
part of the drive to ensure that eventually multiple runs can be performed
concurrently.
* Add set_juju_model/get_juju_model functions to manage which model is in
focus
The idea of this change is to put together helpers for including
functional tests for charms in a central location. The charm
declares the tests and bundles to be run to complete a
functional tests but the tests themselves live here in zaza.
To use this code the charm should have the following:
1) zaza in the test-requirements.txt
2) tox.ini should include a target like:
```
[testenv:func35]
basepython = python3
commands =
functest-bundle-deploy
```
3) Bundles which are to be used for the tests:
```
ls -1 tests/bundles/*
tests/bundles/xenial.yaml
```
4) A tests/tests.yaml file that describes the bundles to be run and
the tests
```
charm_name: vault
tests:
- zaza.charms_tests.vault.VaultTest
gate_bundles:
- xenial
dev_bundles:
- bionic
```
Tests can be run without running a deployment using functest-run-tests
with the list of test classes to be run:
```
functest-run-tests -t zaza.charms_tests.vault.VaultTest
```
Known Issues:
- The deploy_bundle and add_model methods should be using libjuju
- DEV_BUNDLES is currently ignored
- VaultUtils and VaultTest should probably be in separate files.
- When skipIfNotHA skips a test unittest does not pick up it has
been skipped
- A new model is created for each bundle even if an existing empty
model exists
- No model cleanup is performed.
The idea of this change is to put together helpers for including
functional tests for charms in a central location. The charm
declares the tests and bundles to be run to complete a
functional tests but the tests themselves live here in zaza.
To use this code the charm should have the following:
1) zaza in the test-requirements.txt
2) tox.ini should include a target like:
```
[testenv:func35]
basepython = python3
commands =
functest-bundle-deploy
```
3) Bundles which are to be used for the tests:
```
ls -1 tests/bundles/*
tests/bundles/xenial.yaml
```
4) A tests/tests.yaml file that describes the bundles to be run and
the tests
```
charm_name: vault
tests:
- zaza.charms_tests.vault.VaultTest
gate_bundles:
- xenial
dev_bundles:
- bionic
```
Tests can be run without running a deployment using functest-run-tests
with the list of test classes to be run:
```
functest-run-tests -t zaza.charms_tests.vault.VaultTest
```
Known Issues:
- The deploy_bundle and add_model methods should be using libjuju
- DEV_BUNDLES is currently ignored
- VaultUtils and VaultTest should probably be in separate files.
- When skipIfNotHA skips a test unittest does not pick up it has
been skipped
- A new model is created for each bundle even if an existing empty
model exists
- No model cleanup is performed.