Commit Graph

92 Commits

Author SHA1 Message Date
David Ames
0b94bef0d7 Set APT to non-interactive on series upgrade
A number of packages were requiring interaction on upgrade even with
do-release-upgrade -f DistUpgradeViewNonInteractive. By setting DPkg
options in apt.conf upgraded packages do the right thing.

Set 'DPkg::options { "--force-confdef"; };' on hosts being upgraded.
2018-09-19 07:34:24 +00:00
David Ames
a1d152e737 Fix get_project_id 2018-09-18 08:38:02 +00:00
David Ames
c5fe6ce723 Move upgrade series functions to zaza.model
Moving the upgrade series functions to zaza.model. Once the feature
stabilizes we can add functionality to libjuju and remove the
subprocess calls.
2018-09-12 08:22:09 -07:00
David Ames
c4182197d4 Use block_until_unit_wl_status for upgrade timing
Remove all calls to time.sleep and use block_until_unit_wl_status to
manage the timing of the upgrade steps.

Also use run_via_ssh to execute commands while the juju agents are down
during a series upgrade.
2018-09-12 08:20:45 -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
David Ames
77c57df9c6 Must use the snap version of agents when using edge version of juju 2018-09-12 08:20:45 -07:00
David Ames
c80f057eb6 Parameterize workarounds 2018-09-12 08:20:45 -07:00
David Ames
4eb3c2e744 Set model on subprocess juju cmds 2018-09-12 08:20:45 -07:00
David Ames
30082c2311 Series Upgrade
Utilities for performing series upgrades.
Place holder for future stand alone series upgrade zaza test.
Small change to overlay template to allow stand alone zaza tests.
2018-09-12 08:20:45 -07:00
Liam Young
b2a33a451a Fixes related to guest creation tests.
* Make image creation a noop if image already exists
* Two admin projects are created, one in the default domain and
  one in the admin domain. To differentiate between them specify the
  admin domain when searching for the project id. This, in turn, ensures
  that the security group rules are applied to the correct 'default' security
  group.
* Fix cirros image name
2018-09-12 06:32:21 +00:00
David Ames
89e1660be3 Undercloud keystone scope
The get_undercloud_keystone_session function was mistakenly using the
get_keystone_scope function. The get_keystone_scope function is only
for use with the overcloud.

Use of the get_keystone_scope function mistakenly caused undercloud
authentication to mix overcloud authentication.

We would only see this when the overcloud is Liberty because only
liberty uses scope=DOMAIN with keystone v3.
2018-08-31 15:20:35 -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
Nicolas Pochet
d6fa8799d3 Add logging level configuration for all functest-*
Fixes #117
2018-08-20 11:05:38 +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
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
Nicolas Pochet
d8f07e66ab Make exception more generic 2018-08-08 23:21:07 +02:00
Nicolas Pochet
f0e0cdd3c2 Add get_machine_series 2018-08-08 18:46:00 +02:00
Nicolas Pochet
077f2af87c Make get_current_os_release_pair variable
It is possible to use `get_current_os_release_pair` with an argument or
to use the default one (`keystone`)
2018-08-08 18:44:09 +02:00
Nicolas Pochet
d891227494 Add a way to compare OS release pair
It was a functionality available in charm helpers. It is implemented in
a similar way:
* Get the current series from the `keystone` machine
* Get the OS version from `get_current_os_versions`
* Try to find the built string in `OPENSTACK_RELEASES_PAIRS`
It is thus possible to compare release pairs as it returns integers.
2018-08-08 15:23:40 +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
820ed8083d Remove and add BGP speaker from dragent
Workaround for LP: #1784083
2018-08-06 00:03:32 +02:00
Frode Nordahl
97c8c69675 Improve password security
Retrieve password from leader settings on keystone leader
unit.
2018-08-01 15:36:10 +02:00
Frode Nordahl
200ba35d57 Add functions: run command on leader, get leader settings 2018-08-01 15:31:24 +02:00
Liam Young
7a901108c4 Changes to enable testing creainting a guest
This is a bundle of disparate changes that enable testing the
creating of a guest instance. At a high level these are:

* Add helpers for downloading ubuntu images.
* Add method for setting up a basic overcloud network. This is very
  similar to zaza.configure.network.run_from_cli
* Add nova setup module that includes create_flavors and
  manage_ssh_key
* Add nova test base class for launching an instance and two
  derived classes for launching a cirros and lts image respectively.
* Fixes to zaza.charm_tests.test_utils after the refactor of the model
  argument in zaza.models
* New certs.is_keys_valid function to check if a public and private
  key are a pair.
* Methods in utilities.openstack for managing ssh keys. On creation of
  a new key the private key is stored locally and the public key is
  retrieved from Openstack
* Methods in utilities.openstack for testing guests at various points
  of the creation process.
2018-08-01 07:30:24 +00:00
Frode Nordahl
43dea67b00 Merge pull request #85 from gnuoy/feature/charm-overide-local-overlay
Allow charms to override local overlay
2018-08-01 07:42:40 +02:00
Liam Young
f830aaa90c Allow charms to override local overlay
The local overlay ('local-charm-overlay.yaml') is generated on the
fly during deploy time and it assumes that the application name
will match the charm name. However this is not always the case so
allow charms to override the deploy time generated template with
one from the local tests/bundle/overlay directory.

This is really another stop-gap until the whole bundle generation
piece is rewritten.
2018-07-30 07:32:18 +00:00
Ryan Beisner
814614c085 Enable dev_bundles flag and add unit tests 2018-07-17 10:23:17 -04: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
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