Commit Graph

30 Commits

Author SHA1 Message Date
David Ames
40e9c86df4 Test the condition not the implementation 2019-12-10 08:36:22 -08:00
David Ames
c109abbe25 Fix unit test 2019-12-09 09:22:01 -08:00
Liam Young
9c34bc42da Expose model_name option in get_keystone_session_from_relation 2019-11-25 17:40:03 +00:00
Frode Nordahl
8e8544bab7 Fix ovn_present for ovn-dedicated-chassis
Add missing unit test.
2019-11-02 10:31:30 +01:00
Frode Nordahl
7d1d04a742 Deduce whether DVR is enabled from neutron-api config
Add helper to detect presence of OVN in deployment
2019-11-01 06:39:17 +01:00
Frode Nordahl
85927e20c6 Add helper to get uuids of machines w/OVN chassis
Refactor get_machines_for_application as generator function instead
of building and passing on static List.
2019-11-01 06:39:07 +01:00
Chris MacNaughton
045c50637b Add a new SSH function
It is likely that there are other commands that we
would like to run in our tests, so this is a new SSH
command runner that the existing SSH check has been
updated to use.
2019-06-06 13:46:06 +02:00
Liam Young
648ac9262b Expose resource_removeds retry options (#11)
resource_removed is used in many places to monitor removal of
different kinds of OpenStack resource. It is reasonable to expect a
flavor to be removed in a few seconds where as an image based instance
may take minutes to be removed. With that in mind this change
exposes the retry options used by tenacity allowing the caller to
set reasonable expectations for the resource removal.
2019-05-23 11:16:03 +02:00
Liam Young
6b2c1d26eb Add function for getting keystone auth from relation 2019-05-13 09:06:40 +00:00
Chris MacNaughton
dd434e281e Add zaza namespacing, starting with openstack 2019-04-25 17:46:03 +02:00
Liam Young
d90da772d2 Expose resource_reaches_status' retry options (#206)
* Expose resource_reaches_status' retry options

resource_reaches_status is used in many places to monitor many
different kinds of OpenStack resource. It is reasonable to expect a
flavor to be created in a few seconds where as an image based instance
may take minutes to become active. With that in mind this change
exposes the retry options used by tenacity allowing the caller to
set reasonable expectations for the resource state change.

In addition the image based instance creation call is updated
to retry for longer as this has been timing out.

* Remove swap files
2019-03-27 13:02:47 +01:00
David Ames
02180fb178 Unit tests 2019-03-14 08:55:26 -07:00
Liam Young
e9c7690af4 Enable masakari instance monitor tests
Add helpers and a test to test a guest dying and being resurrected
by masakari instance monitor.
2019-03-07 16:03:42 +00:00
Liam Young
3118f122b4 Misc methods to support vm migration tests
Misc methods to support vm migration tests.
2019-03-05 19:30:57 +00:00
Alex Kavanagh
4bf09fc45a Change the image download to download to tmpdir as a default
This is to prevent (as far as possible) putting the image into the
module under test.
2018-09-19 14:24:51 +02:00
David Ames
a1d152e737 Fix get_project_id 2018-09-18 08:38:02 +00: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
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
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
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
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
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
David Ames
ab431a58ad Fix misspelling of utilities 2018-05-14 10:49:49 -07:00