Commit Graph

50 Commits (946e59680e86f81292fe1589620cb949aeaf0eb6)

Author SHA1 Message Date
Federico Ressi 8915ded3da Update time tools
Change-Id: I52b8e5f8fc0dbbfb2c10a80929e52ec1e043427f
3 years ago
Federico Ressi 4196a21048 Refactor testcase module
Change-Id: I2e45e73af87c29ec6395188008f4679a2c9a204c
3 years ago
Federico Ressi 0b6c975fe5 Improve retry APIs
- add retry_test_case decorator
- make typing more explicit
- add support for default retry parameters

Change-Id: I0a5feb9f826416e45cc51bebf467e576c91ebb29
3 years ago
Federico Ressi 6dcb631a08 Use retry tool for waiting for healthy Nova services
Change-Id: Idd8976a67f175363267c4a89ae0a289d0fe76154
3 years ago
Federico Ressi 7dfc3a71fd Create retry tools
Change-Id: If50ced31993b2386fec6f07030e7c4cb5373c238
3 years ago
Federico Ressi 23dd723834 Create time tools
Change-Id: Id19494b9d66dc9a3f4d3d50ba981c0522d544ae4
3 years ago
Federico Ressi b479edeaa3 Return dummuy test case in case not in one
This also merges testcase modules in tobiko.common
package so that there is only one.

Add unit tests for [get|push|pop]_test_case functions.

Change-Id: I0d1d9227dc7ce0e30c327d50f719dc1fbe24e682
3 years ago
Federico Ressi 05c7a924be Allow to get current test case
Change-Id: Ia0796835f5f4bd7c9cf2f3f16f9402ad5bde0859
3 years ago
Federico Ressi 5f143a6e69 Implement cached property tool
Change-Id: I169265771f018d56a518357615afafbe3bf4885a
3 years ago
Slawek Kaplonski 4ee3dced06 Fix looking for ovs agent based on compute node name
In neutron agents faults tests module, there is test which looks
for neutron-ovs-agent which runs on same host as VM is spawned to
stop this neutron-ovs-agent.
This usually worked fine, but in case e.g. of TripleO hostname
given in neutron agents list contained full domain name and
hostname from nova's output containes short name.
Because of this missmatch there was no neutron-ovs-agent found to
stop and test was failing.
This patch fixes this issue by changing comparison of hostnames
of vm's host and agent's host.

Additionally this patch adds proper handling of the case when
neutron-ovs-agent isn't found.

Change-Id: If240188392feb6067af4f9a4a82e8ed95b4b99ee
3 years ago
Federico Ressi 710146be61 Use tobiko.conf directory as starting directory for relative paths
Change-Id: I3b3ed64936cacb7e21420943732caa339ebbbdf9
3 years ago
Federico Ressi c8c71e55eb Add API for defining cloud operations
Change-Id: Ifafa87fc447b34b9e6e686015c6bd7b0dc5f45c5
3 years ago
Federico Ressi 5fe0a7d610 Fix handling of MultipleException
Change-Id: I187c364db9e41c437e9d6dbcbc6df7bfadba43bb
4 years ago
Federico Ressi fc5ffcf87d Safely generate os-faults file to temporary files
Change-Id: If1031a6d600958409d7b505753abdb4feb11a15a
4 years ago
Zuul e7e969c7fe Merge "Use tobiko.makedirs instead of os.makedirs to avoid concurrency problems" 4 years ago
Federico Ressi 47a429d85d Use tobiko.makedirs instead of os.makedirs to avoid concurrency problems
Change-Id: I691cb03e401bc340f13b3388eff7a5565e6f0940
4 years ago
Federico Ressi 481d6d34b0 Allow to gather detail content from a json object.
Change-Id: I5421db227f799d7b1880502ced14fde686edacda
4 years ago
Federico Ressi 6f95a7f4c1 Fix duplicated details gathering
Change-Id: I153709d642adfed8443b71f333d850d3a2a16050
4 years ago
Federico Ressi 335e90d873 Add captured log lines to test case details.
Change-Id: I9615842c9b36dab11aed6561a76cf721c03a6a62
4 years ago
Federico Ressi 3a2863ed5b Rename skip_until to skip_unless
Change-Id: I64c20d6e7b30ade2ee258d5c722f9f895618857c
4 years ago
Federico Ressi 809714571f Delay tobiko config initialization
This should prevent ciclic modules importation from
modules referenced by tobiko.conf itself.

Change-Id: I86d309f4fcc465d64e0af52ebbd61b800efa188b
4 years ago
Federico Ressi 937def3541 Update Neutron resource search
Change-Id: I14a431a8fa6bca7bdef4d2f60e71856716246a04
4 years ago
Federico Ressi 211e1a8c27 Update ipervisors selection by attribute
Change-Id: I7087a61e39a2e3e3831fcbbfe1e8f02a89bd54ed
4 years ago
Federico Ressi 2da3af5c10 Update neutron agent listing
- Fix typo
- Create common function for selecting mapping objects

Change-Id: Ic4b30402e785c0bdcb9e5ed9ede601eb9c0a4860
4 years ago
Federico Ressi 2357ec1ee0 Add function to select objects by attribute values.
Change-Id: Ie1bc1ed16c6128cb87380b34d42104edfffa44a2
4 years ago
Federico Ressi f493b9b1b5 Create base mixin class for patching in unit tests from test cases and fixtures
Change-Id: Ie8a706809f975d2156601148267e4079666c0fbb
4 years ago
Federico Ressi ae4accef4e Create wrapper to sys.exc_info
try:
     ...
 except SomeException:
     with tobiko.exc_info():
         # It will reraise original exception at the end of this block
         ...

Change-Id: Icad6bdd7261dd9b972b5b33110041876ca488070
4 years ago
Federico Ressi 1dfc6ccc6b Add check valid type function
Change-Id: I465f0303b1bbf1e288c288800e3dc53b6d4bfe54
4 years ago
Federico Ressi 4852179927 Add reset fixture function
Change-Id: I1d4e291a5f7f575be33682902b3d4f414fe8f1ff
4 years ago
Federico Ressi 53b0b45a42 Add fixture_property decorator
Add a new decorator that improve property decorator
by allowing to invoke getter method from fixture class.

This makes below code to work:

import tobiko

class MyFixture(tobiko.SharedFixture):

  @tobiko.fixture_property
  def my_property():
      return ...

assert tibiko.get_fixture(MyFixture).my_property == MyFixture.my_property

Change-Id: I72b6b8305823bb7be2bee6a806a6bced915229f6
4 years ago
Federico Ressi 1f2717321f Add missing copyrigths
Change-Id: Ia0fe276fc82ea3d56f766873c479fa901d6677c3
4 years ago
Slawek Kaplonski 945b7f5ad7 Add required fixtures to tobiko-fixture list command
Command "tobiko-fixture list" now includes also fixtures
defined as required fixtures for test classes.

Change-Id: If9b9fb05dbdc7129ac50d71904c91a3ee04648f6
4 years ago
Federico Ressi dbfaad99bd Move tobiko.common.managers.fixture to tobiko.common package.
Change-Id: Iaa6962df2c1a28ae348eb6d2e690ff8b2ae17b84
4 years ago
Federico Ressi 9a1edb1a7d Import base exceptions from main tobiko module.
Change-Id: Ieb1001acc6fa2cd86ca51a544bd34a4aaf7c78b8
4 years ago
Federico Ressi 8a9a57ff22 Import base exception from tobiko package
Change-Id: I0d825064300224b07dfdf8eab41cf4d7550cdae6
4 years ago
Federico Ressi b907b1edd2 get_fixture with fixture instance return instance itself.
Change-Id: Ie1528b941316579f807aa91aac28ed514b1e3a9c
4 years ago
Federico Ressi dc6147f933 Make shared fixture class smarter to use.
Change-Id: I012ae957081bb34117315435b38556e553b88b7c
4 years ago
Federico Ressi be5135cd66 Implement "setup" and "cleanup" fixture sub-commands.
Change-Id: I87eb6fd16310b596f87d89a4fd89ae03ef02d77c
4 years ago
Federico Ressi 19a8039f11 Implement shared fixture base class.
Change-Id: I98919acb54bcd112bf633615391876175d819a8c
4 years ago
Federico Ressi 903e85083d Rebase fixture management on top fo fixtures library.
Change-Id: Idb34d4bebc1be6d753e4805f58a1a71c84ee15b7
4 years ago
Federico Ressi 7f30a885f0 Discover test case method dependencies using load_object function
Refactor fixture manager to avoid reverse control pattern.

test cases method dependency on fixtures is now obtained
from default parameter values discovered from test case
methods signatures.

Change-Id: I4eb04189adb9aab27923b167910f32c49c33d8e0
4 years ago
Federico Ressi 75d5825610 Implement load_module function
Change-Id: Ia5640962fbece169501838a410fb5ac36e8f360b
4 years ago
Zuul 80f77f1dfd Merge "Remove load_modules method" 4 years ago
Federico Ressi b3a11e9d3b Remove load_modules method
Change-Id: I578d309472393c9b5c01fe71a651f6c1436dc72f
4 years ago
Federico Ressi 492905d71b Add object loader
Change-Id: I921a3ba37ca49eec29fb74c0a131308791b1ef7c
4 years ago
Federico Ressi b6d06dcdbb Create method to load test case modules.
Change-Id: I0f8d79708bca80c3395289d395bf2d197ed02e42
4 years ago
Federico Ressi 0ef14525b7 Create method to list test case IDs unsing stestr
Change-Id: I68e2e1b6aa88ea2b6d72e65201fa771af181d61b
5 years ago
Federico Ressi 487281e7a7 Create abstract fixture manager
Allow to decople global fixture definition from test
cases.

Fixtures can be defined as a subclass of tobiko.Fixture

  class MyFixture(tobiko.Fixture):
      ...

Tobiko will reference to it as: '<module-name>.MyFixture'
where module-name is the full name of the module where
the class is defined. Fixture name are accessible via
'fixture_name' class attribute.

tobiko.Fixture subclass has to implement bellow methods

  def create_fixture(self):
      # mandatory
      ...

  def delete_fixture(self):
      # optional method
      ...

Test cases to create a fixture should mane one of below
calls:

  fixture = tobiko.create_fixture(<fixture-name>)
  fixture = tobiko.create_fixture(<fixture-class>)

Existing fixtures can be find using one of below calls:

  fixture = tobiko.get_fixture(<fixture-name>)
  fixture = tobiko.get_fixture(<fixture-class>)

Existing fixtures can be deleted using one of below calls:

  tobiko.delete_fixture(<fixture-name>)
  tobiko.delete_fixture(<fixture-class>)

Change-Id: I5c104a732234ab2183fbfb9909cba4a445f59b60
5 years ago
Federico Ressi dea1ecfb21 Remove copyrigth notices from empty __init__.py files
Change-Id: I41cb71ef43969a24cfc37f39c97e07960f21ad00
5 years ago
abregman 4b3a02a3cd Add initial structure
Including required files for installing and
packaging the project.

Change-Id: I592784819e78075bfc08b52a17d1b42e511da95c
5 years ago