Commit Graph

20 Commits

Author SHA1 Message Date
Dmitriy Rabotyagov b88a8fbb16 Fix linters
Change-Id: Ide46cd2379d6ba32c844a9779ecfd32faead7b35
2020-10-01 13:44:46 +03:00
Hervé Beraud 18dd391ae9 Stop to use the __future__ module.
The __future__ module [1] was used in this context to ensure compatibility
between python 2 and python 3.

We previously dropped the support of python 2.7 [2] and now we only support
python 3 so we don't need to continue to use this module and the imports
listed below.

Imports commonly used and their related PEPs:
- `division` is related to PEP 238 [3]
- `print_function` is related to PEP 3105 [4]
- `unicode_literals` is related to PEP 3112 [5]
- `with_statement` is related to PEP 343 [6]
- `absolute_import` is related to PEP 328 [7]

[1] https://docs.python.org/3/library/__future__.html
[2] https://governance.openstack.org/tc/goals/selected/ussuri/drop-py27.html
[3] https://www.python.org/dev/peps/pep-0238
[4] https://www.python.org/dev/peps/pep-3105
[5] https://www.python.org/dev/peps/pep-3112
[6] https://www.python.org/dev/peps/pep-0343
[7] https://www.python.org/dev/peps/pep-0328

Change-Id: I0b77453c1b8436a5057d1cd33d7f3d5a28f7c394
2020-06-02 20:33:09 +02:00
zhufl 4fded62ffa Fix :param: in docstring
:param should be used in docstring instead of :param:.

Change-Id: Ife417efb9d5741c6f0546b60906fa02ce2a2f92b
2019-07-15 06:33:25 +00:00
Jean-Philippe Evrard 4df9332649 Use clouds.yaml
Instead of passing all things to the client, and forgetting some,
we should directly load the config, and use the cloud
configuration for creating connections.

Change-Id: I8e66ff033b6d49537b161710e983750f40d5e93d
2018-02-13 11:02:27 +00:00
Jimmy McCrory f613a07be9 Remove use of deprecated profile parameter
The use of the profile parameter in openstacksdk's connection object has
been deprecated and is currently causing upgrade testing to fail.

Change-Id: If2c0ae577df3e174773b045b7c9efdd285ee1a6d
2018-02-03 12:46:51 -08:00
Nolan Brubaker 54f91a1b2f Add API query test for Swift
This test will be useful in gauging API availability for Swift during
upgrades

Change-Id: I1e5ac7ab1cfed15771fdb205d5736da206929bc6
2017-06-05 13:13:28 -04:00
Nolan Brubaker 9ba0e9a2a2 Refactor glance image tests to use OpenStackSDK
This reduces the number of direct dependencies, and makes the tests more
uniform.

Since glance was the only remaining test with the direct client
references, the imports and code using the clients directly have been
removed.

Change-Id: I81ac9273ee1646ede23e435da56ff211546a7d04
2017-06-02 14:49:18 -04:00
Nolan Brubaker bf6a0ac805 Refactor Keystone test to use OpenStackSDK
By using OpenStack SDK, the tests are more uniform, and we reduce the
direct dependencies we have to install.

Change-Id: Ic5ee06367904ba6bc569399432908de1b08233cd
2017-06-02 11:18:39 -04:00
Nolan Brubaker 72e1f18036 Add Cinder API test
Poll the cinder API for a list of known volumes

Change-Id: Ie6a854edb276a0ee2e3066035a700af239924e57
2017-06-01 16:08:00 -04:00
Nolan Brubaker b9bbfc92bf Add Neutron API test
Query the Neutron API for networks.

Added the get_objects helper method since simply listing resources
appears to be a fairly common operation in these tests. Will refactor
existing tests to conform to this standard in a separate patch.

Change-Id: I78fab1083e90bff8db46842b87f73556df153541
2017-05-31 14:12:10 -04:00
Nolan Brubaker dc46ab7ba6 Add Nova service test capability
Basing Nova work directly on the OpenStackSDK so that there are fewer
(direct) dependencies in this code. Glance is only modified so that the
import naming is more explicit.

We don't create a VM in order to reduce dependencies on external
services such as neutron or cinder.

Change-Id: I5385754d29d5008ab5ea16bf84f4192051c5c70a
2017-05-31 12:33:15 -04:00
Nolan Brubaker d806114129 Make console logging optional
Console logging is useful when using the tool interactively, but
generats extra noise when using in a gating scenario. Move this into a
flag that enables it should it be necessary.

As part of this, the failure rate will be printed to stdout regardless
of console logging's status. This is so automated tools can use the
returned number to check for passing or failing.

Also, remove the old `configure_logging` function that was no longer in
use.

Change-Id: I55d410e6d504b03993f90cfd38dcd938390d02d5
2017-05-24 23:15:34 -04:00
Nolan Brubaker 77a61e8cdd Catch all errors and provide failure summary
In order for the gates to get a meaningful metric to pass/fail against,
write out the percent of failed attempts (that is, attempts that caused
some exception) after receiving a termination/interrupt.

Along with this, change the except clause in the test loop to catch all
failures and log them, rather than aborting the program. This will allow
the program to keep running until explicitly stopped, providing more
accurate results.

Since the exceptions are being caught at the loop level, the tests
themselves can use a 'happy path,' without doing their own error
handling. This makes implementation of tests more straightforward.

Change-Id: I10436d1f3e99234aa167ab7a765e59d46d54eeb8
2017-05-22 16:36:47 -04:00
Nolan Brubaker 325076bef6 Allow graceful exiting with SIGINT and SIGTERM
The test_loop function was only gracefully interrupted with a keyboard
interrupt before. This is fine for interactive testing, but in an
automated scenario the script may be running in the background and need
to receive a signal from some other process, such as Ansible.

This patch adds a handler for SIGINT and SIGTERM that will allow the
current iteration of the loop to finish, then exit the program cleanly
by putting the test_loop function into a class. The test_loop function
is not refactored other than to add the `stop_now` flag, though the
internal variables may be amenable to later refactoring to use the
class.

Change-Id: I0667d2c7093e2821afdfcea987cec6b58515885f
2017-05-22 11:59:23 -04:00
Nolan Brubaker 56ac318f21 Make usage of exceptions more uniform
The keystone test relied on the exception handling in the test loop -
this should be brought down into the keystone test since it's
specifically looking for failures there.

Also import the glance exceptions module with a more descriptive name.

Change-Id: Iaed4d3fc411630b506dad4769ccdcecbf6afeb1f
2017-05-22 11:25:12 -04:00
Nolan Brubaker 0c3ddf20b1 Implement CLI test picker
This change moves the tests into classes that handle the logging, set
up, and teardown of necessary data (like files). These classes are
provided to the test loop by a dictionary look up of the test cases.

Currently implemented are Glance and Keystone. There is also
functionality to query the registered tests and provide descriptions.

Change-Id: I164b85f1ca800dd58146c6793696adaf80634621
2017-05-19 11:47:49 +00:00
Nolan Brubaker b0c10ad39a Move keystone and glance to a single file
This single file will become a CLI tool that can launch any test. This
is preliminary work at merging the previous two files together and
getting a running result.

The loop was consolidated into one function, with each test also being a
function. Some utility workers were also provided.

Later work will add a command line interface for choosing a test. For
now, it simply executes the glance test since it's more comprehensive.

Change-Id: I68aa10a6f7126b7a74e474e74b7f0948c6dc20f8
2017-05-18 11:32:17 -07:00
Nolan Brubaker ede1af70b9 Add a basic glance API tests
One script will loop over the glance image list and collect response
times in a common logging format.

The other attempts to upload a small binary file to the glance store in
order to see a 'real' use case.

Change-Id: I2d2aabb802774e28746be7eabafb0578998fdd37
2017-03-20 15:36:15 -04:00
Nolan Brubaker c2aeb03b10 Unify output formatting, add logging
Since there is no central storage for the restart actions and the tests
at the moment, they should have timestamped output to correlate events.
Using a standard format will make this easier to do programmatically,
too.

The output is sent both to stdout and a log file. Additionally, Ansible
output is suppressed now, so it doesn't pollute the console. Log times
are in UTC, to avoid timezone mismatches between nodes (observed in
multi-node AIOs).

The `configure_logging` function was copied into the tests/keystone.py
file instead of put into a common module in order to keep that file a
standalone unit for the time being.

Change-Id: I399d1827a8559896ca87e45c00241293ccd033d2
2017-03-15 16:36:32 -04:00
Nolan Brubaker 0ebc0430d7 Add rolling downtime simulation tools
These tools help simulate rolling downtime by taking down service
containers in a controlled fashion. While this can be done manually,
using a script to inspect the inventory for targets is much easier.
Having the rolling downtime happen automatically is also a bit less
error prone.

Tests for things like response times will be placed in the tests
directory, allowing for scripts to be written against different services
to try different things (like adding resources while rolling downtime
happens).

There is no central orchestration for the two components currently, in
order to keep things simple. Restarting containers and running the tests
is therefore best accomplished in a pair of tmux sessions.

Change-Id: I2d8e3484bbb1a71d2cd0c4124f824d49f76e5c2c
2017-03-09 16:29:13 -05:00