Commit Graph

60 Commits

Author SHA1 Message Date
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
Liam Young
08aacfd0ec Allow model settings to be added or overridden 2018-07-12 12:03:12 +01:00
Frode Nordahl
2a566b5e05 Fix keystone tls detection and verification
At present the check for which transport to use references a
configuration option that has been removed.

Update check to test for current configuration option plus
add a check for presence of `tls-certificates` relation.

Also remove insecure option and add verify option to allow
control of verification including providing own CA certificate
bundle.

Reference for verify option:
https://docs.openstack.org/keystoneauth/latest/api/keystoneauth1.html#keystoneauth1.session.Session
2018-07-04 13:17:25 +02:00
Liam Young
e6848dc448 Enable doc string lint checks
Enable doc string lint checks excluding unit tests.
2018-06-21 09:45:45 +01:00
Chris MacNaughton
c13ea8f282 .get will never throw the exception we expect on mismatch 2018-06-20 17:24:21 +02:00
Chris MacNaughton
57ee4a3662 syntax fix and add unit test 2018-06-20 17:09:34 +02:00
Liam Young
f0d91ae31b Fix caching of model name and remove debug lines 2018-06-14 06:23:26 +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
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
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
6c12a8104d Fix unit test 2018-05-31 10:30:28 +01:00
Liam Young
56c8d60dcd Add tests for testing the glance charm
* Add OpenStackAPITest class which can be used by OpenStack API
  charms. It provides the framework for common tests like pause
  and resume. It also provides lower level entites like an
  authenticated keystone session.
* Add generic openstack resource managment functions to
  zaza.utilities.openstack. These are based on existing functions
  in charmhelpers. Main difference is that they use tenacity to
  manage retry logic and throw AssertionError if then required state
  is not reached rather than returning True/False
* Add image management functions to zaza.utilities.openstack.
* Add set of glance setup/configuration/tests. These are equivalent
  to the existing glance amulet tests with all the introspection
  tests removed (see below for more detail).

Tests replicated here:
    test_410_glance_image_create_delete
    test_411_set_disk_format
    test_900_glance_restart_on_config_change
    test_901_pause_resume

Tests removed
    test_100_services
    test_102_service_catalog
    test_104_glance_endpoint
    test_106_keystone_endpoint
    test_110_users
    test_115_memcache
    test_200_mysql_glance_db_relation
    test_201_glance_mysql_db_relation
    test_202_keystone_glance_id_relation
    test_203_glance_keystone_id_relation
    test_204_rabbitmq_glance_amqp_relation
    test_205_glance_rabbitmq_amqp_relation
    test_300_glance_api_default_config
    test_302_glance_registry_default_config
2018-05-30 13:40:50 +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
4f2abc87c8 Add unit tests for loglevel command line argument parsing 2018-05-22 09:05:44 +02:00
Frode Nordahl
c4c2075532 Add unit test for model.get_relation_id() 2018-05-16 07:10:31 +02:00
Frode Nordahl
64b2d3de8b Infer ASn from deployment for BGP speaker test configuration 2018-05-15 21:59:19 +02:00
David Ames
ab431a58ad Fix misspelling of utilities 2018-05-14 10:49:49 -07:00
David Ames
a73f513b97 Shortname utilitites 2018-05-14 10:49:49 -07:00
David Ames
f2982a4f1f Split _local_utils into functional modules
The _local_utils module was misnamed as the utilities it contained
may be used outside of zaza proper. For example in mojo.

This change separates the utilities into functional modules:

 cli_utils: For utilities pertaining to running scripts from command line.
 juju_utils: For utilities pertaining to juju commands.
 generic_utils: For helper utilities that are generic in nature.
2018-05-14 10:49:49 -07: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
Frode Nordahl
8906f7a8c1 Add support for generating certs with multiple SANs 2018-05-11 12:02:29 +02:00
David Ames
59f304147f Merge pull request #47 from gnuoy/feature/check-file-contents
Add block_until_file_has_contents helper
2018-05-08 09:39:05 -07: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
77c7f896f7 Bug fixes for mojo's use of zaza
Now with more unit tests!
A couple of minor bug fixes exposed while testing mojo's use of zaza.
2018-05-04 23:09:34 +00:00
Liam Young
34c6431658 Add method for signing csrs 2018-05-03 16:30:06 +00:00
Liam Young
afdee65966 Merge pull request #44 from openstack-charmers/add-utilities-generate-cert
Add utility helper function for generating X.509 certs
2018-05-03 12:03:03 +01:00
Frode Nordahl
092c3c1f6b Add utility helper function for generating X.509 certs 2018-05-01 14:17:10 +02: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
David Ames
1461761fb8 Rename get_net_info to get_network_config
The configure.network script had already made this change. Using
run_from_cli ran into the fact that it was not changed in
utilities._local_utils.

Update for consistency.
2018-04-25 15:51:33 -07: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
9ad502c58c Merge pull request #35 from thedac/issue/34
Use short model names
2018-04-21 07:32:01 +01:00
David Ames
bc89acd838 Merge pull request #24 from gnuoy/feature/optionally-pass-bundle-to-runner
Add option to allow bundle name to be passed to runner
2018-04-20 14:54:38 -07:00
David Ames
b4d55caf19 Use uuid.uuid4 to generate model name
Take the last 12 characters from a uuid for generating the model name.
uuid.uuid4 takes into account the host and the current timestamp and
should be sufficient for our needs.
2018-04-20 11:25:24 -07:00
David Ames
8464efab7e Use short model names
Issue #34 Long model names cause OpenStack DNS to break. We gain fairly
little by stacking information in the model name.

This change uses zaza-$TIMESTAMP as model names.

Closes Issue: #34
2018-04-20 10:44:31 -07:00
Frode Nordahl
a87da7afd1 Merge pull request #30 from thedac/feature/dragent
Neutron dynamic routing testing
2018-04-20 19:40:34 +02: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
Chris MacNaughton
5e8dd1654d Ensure we use default model constraints
Models which are created by Zaza should enable test mode,
to prevent artificially ticking metrics in the charm store for charm usage.

In addition, models must not retry failed hooks as we
consider a hook failure to be an error.

Closes #33
2018-04-20 08:25:04 +02:00
David Ames
6ad3745206 Separate overcloud and undercloud settings
Changed the name of configure_dragent
Removed the network.yaml file requirement for tests
Made a bright line distinction between declared overcloud network
settings and environment specific undercloud settings
The tests will declare the overcloud settings and acquire the
undercloud settings from environment variables.
2018-04-19 14:42:29 -07: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
David Ames
4278e5822d Neutron dynamic routing testing
Add the testing required for neutron dynamic routing A.K.A dragent.
Create the zaza.charm_tests.dragent module for testing neutron dynamic
routing.
Create the zaza.configure module for reusable configuration tools.
Update utilities to simplify authenticating clients.
2018-04-18 16:14:23 -07: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
James Page
be4e9732fe Merge pull request #25 from gnuoy/feature/generate-local-charm-overlay
Render local charm overlay from string
2018-04-18 10:31:43 +01:00
Liam Young
56b0f556a6 Add the missing t 2018-04-18 08:57:38 +00:00
Liam Young
2e522f2ab4 Render local charm overlay from string
Stop requiring the charm to ship with a boiler plate overlay for
setting a relative path for local charm location. Instead render the
overlay from a string var. As part of this some of the template
rendering code was refactored.
2018-04-18 07:35:55 +00:00
Liam Young
1bbb092aa6 Add option to allow bundle name to be passed to runner 2018-04-17 16:00:14 +00:00
Liam Young
05e02a94cd Add zaza to generated model name 2018-04-17 13:21:49 +00:00
Liam Young
ed98e8f02d Stop missing overlay templates from being fatal
Not all deployments will use overlays so a missing template should
not be fatal
2018-04-17 12:00:17 +00:00
Liam Young
51fb79c24f More env var refinement 2018-04-16 14:17:57 +00:00
Liam Young
7f09add0d0 Switch to OS_ as the prefix for environment variables that can be used in overlay template rendering 2018-04-16 14:13:23 +00:00