Commit Graph

32 Commits

Author SHA1 Message Date
David Ames ea120ee0a5 Add controller module
The controller module allows us to run commands against the controller
including listing all models and getting the cloud configuration name.
2018-05-14 10:49:49 -07:00
Liam Young c7a8960036 Break up async_block_until_file_has_contents
Refactor so that async_block_until_file_has_contents
in a specialisation of async_block_until_file_ready
2018-05-08 12:19:21 +00:00
Liam Young 1cf86356dd Fixed a few docstring errors 2018-05-08 08:52:33 +00:00
Liam Young 458a7207d8 Add block_until_file_has_contents helper
Add a helper which will block until a string appears in a particular
file of an application.
2018-05-08 08:48:19 +00:00
David Ames ae257a0955 Functionality to enable mojo's use of zaza
Without introducing mojoisms into zaza there are some changes that are
required to enable mojo's use of zaza.

The goal is to keep mojo specific utilities in openstack-mojo-specs and
to move any generalized tools here in zaza.

This change updates some generalized zaza tools to enable mojo to use
them.
2018-04-30 16:13:50 +00:00
Liam Young a314a82d27 Always use startswith for checking WL status msgs (#42)
Currently there is no way for the tests.yaml to specify if the
expected workload status message should be checked as a prefix
or as an exact match. I think the prefix approach actually covers
all our use cases so rather than complicate the tests.yaml
options lets just always use startswith for checks.
2018-04-26 11:30:19 +01:00
Liam Young 34b6f5638a Bump deploy timeout 2018-04-25 18:32:35 +00:00
Liam Young d00af5028e Fix race in checking deployment complete
If the deployment state is assessed before any units have been
provisioned then the checks passes as there are no active units
or units with bad states etc. So, wait for at least one unit to
be provisioned before running checks
2018-04-25 10:32:46 +00:00
Liam Young 68114544bd Add the ability to wait for bespoke statuses (#38)
* Add the ability to wait for bespoke statuses

This change adds the ability to wait for bespoke work load
statuses and messages. These are defined in the charms tests.yaml

* Add unit tests

* Remove debug print

* Fix typos and add checks for  errored units

* Restore juju_wait as openstack_utils imports it
2018-04-25 09:48:31 +01:00
Liam Young a58029fe46 Update doc string 2018-04-20 13:45:41 +00:00
Liam Young 9861ca6f4d Vault charm action needs to be run on leader
The vault charm action to authorise the charm within vault needs to
be run on the leader. This mp adds run_action_on_leader to support
that and updates the tests.
2018-04-20 13:40:52 +00:00
Liam Young bcfd6aaf30 Add tests for vault authorize-charm action
Add tests for the authorize-charm action on the vault app. To
support this add get_action method to return an applications
actions. However, this is not implemented in libjuju yet so
fallback to subprocess
2018-04-19 11:41:09 +00:00
Frode Nordahl be24513e1c Merge pull request #29 from gnuoy/feature/add-run-action
Add juju run_action support
2018-04-18 21:54:40 +02:00
Liam Young 769a6b9cc4 Fix doc string 2018-04-18 19:51:43 +00:00
Liam Young 7e07abb4c4 Fix doc string lint as per tinwoods comments 2018-04-18 16:24:04 +00:00
Liam Young 4cec473ede Remove old run_in_model_old method and fix param ordering in doc strings 2018-04-18 15:39:04 +00:00
Liam Young acbcf98d68 Add juju run_action support 2018-04-18 15:34:27 +00:00
Liam Young d65dd96f26 Use async_generator pkg to simplify async calls
Use the async_generator, yield_, asynccontextmanager methods from
async_generator to simplify the creation of sync wrappers around
async libjuju calls
2018-04-18 13:36:13 +00:00
David Ames 44920b9790 Remove dynamic default arguments 2018-04-13 07:48:21 -07:00
David Ames bcf8a21c35 Fix set_appliction_config 2018-04-12 16:28:48 -07:00
David Ames 6eae8a0fbb Use libjuju unit.run for juju_run
Use libjuju for juju run commands
Add unit test for model.run_on_unit
2018-04-12 10:43:35 -07:00
David Ames 22e7ffc1e1 Bring over network specific utilities
Bring over only those utilities required to run network_setup.py from
openstack-mojo-specs. These utilities have been generalized and python3
configured. Use libjuju whenever possible and pre-deprecate anything
else.

Add addition functions to the model.
2018-03-30 16:41:17 -07:00
Liam Young 117ae4127d Add function to scp file to all units 2018-03-29 05:35:49 +00:00
Liam Young 59a9b7f0cb Add helper utils for interacting with juju environment 2018-03-29 05:35:49 +00:00
Liam Young 353559528b s/charm_testing/charm_lifecycle/ and unit tests 2018-03-27 12:35:38 +00:00
Liam Young 12c7363b34 Remove new unit_ips from mp, will add in as a seperate mp 2018-03-26 08:31:26 +00:00
Liam Young 458a76f05a Add helps for charm functional tests
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.
2018-03-26 08:31:26 +00:00
Liam Young 5e613051bc Remove new unit_ips from mp, will add in as a seperate mp 2018-03-26 08:28:10 +00:00
Liam Young 502b96c772 Add helps for charm functional tests
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.
2018-03-26 08:28:10 +00:00
Ryan Beisner ce93194a1f Fix additional lint 2018-03-22 15:13:53 -05:00
Chris MacNaughton ddbbce3712 remove extra comments 2017-12-04 17:38:52 +01:00
Chris MacNaughton 895fbbad57 add current-apps script 2017-12-04 17:38:16 +01:00