Commit Graph

70 Commits

Author SHA1 Message Date
David Ames 8874fc7961 Fix docstrings 2018-09-12 08:22:09 -07:00
David Ames fb67806fc6 Use status output for block_until_unit_wl_status
unit.workload_status was actually reporting the application workload
status. Using the full status output from model.get_status() gives us
unit by unit workload status.

Updated block_until_unit_wl_status to use the full status output to
correctly block per unit.
2018-09-12 08:20:45 -07:00
Frode Nordahl 9eda316756 Merge pull request #119 from fnordahl/pause-lead-unit-in-key-rotation-test
Pause lead unit in key rotation test
2018-08-20 11:35:21 +02:00
Frode Nordahl f4f25716a2 Add get_lead_unit_name function 2018-08-20 09:49:55 +02:00
Frode Nordahl 6c5e06ed86 Merge pull request #109 from n-pochet/unit-from-name
Make `get_unit_from_name` use `model_name`
2018-08-17 09:01:48 +02:00
Nicolas Pochet 7b1441d953 Make get_unit_from_name use model_name 2018-08-17 08:58:16 +02:00
Frode Nordahl 2c39eb2c7a Merge pull request #110 from n-pochet/add-exception
Add `CommandRunFailed` exception
2018-08-17 08:44:50 +02:00
Nicolas Pochet fb39813bb1 Add CommandRunFailed exception
Add exception to make the exception's message building easier.
2018-08-17 08:23:39 +02:00
Frode Nordahl 4726db35af Fix race in test_utils.config_change()
When changing config we have a race that make the idle/ready
check run *before* the `config-changed` hook has started executing
on units.  Subsequently tests are sometimes executed before or while
configuration change is in progress, leading to intermittent false
negative test failures.

Fixes #113
2018-08-16 14:48:20 +02:00
Nicolas Pochet b84b24b72a Fix parameters passed to async_run_on_unit
Fixes #111
2018-08-14 11:02:33 +02:00
Nicolas Pochet 90491103ce Handle unit or app not found
Fixes #104
2018-08-09 16:42:21 +02:00
Nicolas Pochet 193e2657ff Add copyright header everywhere.
Also make flake8 happy in setup.py by adding docstrings.
2018-08-09 11:55:13 +02:00
Frode Nordahl 8dbe371d62 Make it possible to call run_action() without passing action_params
Fixes #94
2018-08-08 11:34:18 +02:00
Frode Nordahl e408be6719 Fix ordering of arguments in call to async_run_on_unit
Fixes #91
2018-08-08 10:56:25 +02:00
Frode Nordahl 200ba35d57 Add functions: run command on leader, get leader settings 2018-08-01 15:31:24 +02:00
Liam Young ea7336a67e Allow model constraints to be passed via env vars
Allow model constraints to be applied to models that zaza
creates.
2018-07-13 12:36:14 +00:00
Frode Nordahl cd29cee799 Merge pull request #79 from gnuoy/fix-stale-model-name
Update model name cache when switching models
2018-07-10 09:08:19 +02:00
Liam Young 3b738f279e Update model name cache when switching models
The model name cache needs to be updated when switching models
otherwise calls to get_juju_model get a stale results. Closes
2018-07-10 08:00:07 +01:00
Liam Young 294d8f5fd0 Cope with Workload status unknown messages
Some charms never implemented the workload status messages, these
charms have a wl status of unknown and wls message of ''. This fix
allows a wls of '' to be specified.
2018-07-09 15:17:07 +00:00
Chris MacNaughton 57ee4a3662 syntax fix and add unit test 2018-06-20 17:09:34 +02:00
Chris MacNaughton 063aadd4df add MODEL_NAME variable to determine model 2018-06-20 17:04:11 +02:00
Liam Young a5c15f9b7a Rebase 2018-06-15 10:49:39 +01:00
Liam Young 398c057007 Docstring tidy of zaza.model 2018-06-15 10:44:53 +01:00
Liam Young f0d91ae31b Fix caching of model name and remove debug lines 2018-06-14 06:23:26 +01:00
Liam Young 9b26376a19 A few fixes 2018-06-14 06:20:05 +01:00
Liam Young 9d06bb890f Move call to get_juju_model() down to run_in_model
Currently interacting with functions in zaza.model requires the
model to be passed in. This has resulted in multiple calls to
get_juju_model(). It is cleaner to push these calls down into
the model wrapper and make the model_name an optional
argument. In addition, the current model name is now cached
without having to check the os.env each time.

Unfortunately this has resulted in the signature changing on a
great many function so this diff is bigger than would normally
be desirable.
2018-06-14 06:19:26 +01:00
David Ames 7b10df57d8 Merge pull request #61 from gnuoy/remove-timeout-workaround
Remove workaround for libjuju timeout bug
2018-06-13 15:18:15 -07:00
Liam Young 0aa7c61719 Remove duplicate functions for add/remove model
Recently functions were added to zaza.model for adding and removing
models. These duplicated existing functions in zaza.controller.
Given these functions act against the controller, zaza.controller
feels like the correct location. In addition the implementations in
zaza.controller correctly handle disconnects which the new ones
did not.
This PR removes the duplicates and points any existing references
from zaza.model to zaza.controller. Finally, docstrings were added
and documentation links.
2018-06-13 09:49:33 +01:00
Frode Nordahl a0e9064f2b Merge pull request #62 from gnuoy/remove-model-subprocesses
Use libjuju for adding and removing models
2018-06-07 10:33:07 +02:00
Liam Young 0353d300e1 Fix typos 2018-06-07 09:25:07 +01:00
Liam Young 0568fd17b7 Fix lint 2018-06-07 09:06:13 +01:00
Liam Young 0b6f6d88dc Documentation fixes 2018-06-06 15:54:06 +01:00
Liam Young b21767ce52 Use libjuju for adding and removing models
libjuju supports adding and removing models so replace calls out
to subprocess with libjuju calls
2018-06-06 12:28:08 +01:00
Liam Young 01bd9b88c9 Remove workaround for libjuju timeout bug
The timeout bug for libjuju run has been resolved:

https://github.com/juju/python-libjuju/commit/462989bbd919f209ebb7454305f53e4b94714487

so remove workaround.
2018-06-06 09:53:16 +01:00
Liam Young 313f7bee02 Remove debug print 2018-05-22 15:34:58 +01:00
Liam Young 86d641e333 Minor tidy 2018-05-22 15:33:34 +01:00
Liam Young cbc14e32c6 Another batch of zaza.model helpers
This pr adds a number of new fuctions to zaza.model. As discussed
zaza.model needs to be broken up as it has become too large. I would
like to continue the discussion around that and submit a subsequent
patch for that at a later date.
2018-05-22 15:28:28 +01:00
Frode Nordahl 64b2d3de8b Infer ASn from deployment for BGP speaker test configuration 2018-05-15 21:59:19 +02:00
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