Commit Graph

582 Commits (cd147631f8254c2f727ccfc937566a7a200349f9)

Author SHA1 Message Date
Zuul 05628f2e91 Merge "Remove six.PY3/six.PY2" 3 years ago
zhufl 3ead99814d [Trivial]Remove unused variables
This is to remove unused variables and to use merging-isinstance.

Change-Id: I9d7121678a8b18a03b7b872526bfc74351560776
3 years ago
likui 7d91c87345 Remove six.PY3/six.PY2
The Python 2.7 Support has been removed by:
https://review.opendev.org/#/c/704096/
So remove hacking rules for compatibility between python 2 and 3

Change-Id: I0e78b982b79674520c7695c0cca7352677d7b7a0
3 years ago
Masayuki Igawa 9e492eee81 Use os.path.join as possible
This commit makes to use os.path.join instead of using the Unix path
character '/'. This change is not mandatory since we don't support
Windows environments as Tempest execution and, it seems Windows supports
'/' as a path separator. However, using both os.path.join and '/' is a
bit awkward.

Change-Id: I117acb281c352179d526808009e761335bb314fc
3 years ago
Doug Schveninger 6aa733e0f3 Improve unit tests for subunit_describe_calls
in order to enhance the cmd to support kubernetes url based
routing over port based routing.  Once this is merged I will
submit another patch set to subunit_describe_calls to support
-u --urls (Optional) The path to a JSON file describing the urls
  being used by different services. Note Can not be used with -p.

Added test cases for cliff subprocess and found a bug with the
-v. The standard -v --verbose of cliff conflict with this command
 so I changed the -v --verbose to -a --all for print header
with printing to stdout I am also getting ready to add test cases
for cliff subprocess support for different options. Bug #1890060

Correct os join in test cases to avoid a conflict with
https://review.opendev.org/#/c/683026

Closes-bug: #1890060
Change-Id: I9459db0dbeda721187ea5f4802c7453c2092dac3
3 years ago
Zuul ecf2d6817b Merge "Fix the argument check for account-generator" 3 years ago
Lukas Piwowarski 58b0538670 Fix the argument check for account-generator
Concurrency parameter for account-generator command was accepting
negative values and zero.

This patch makes sure that when the account-generator is passed
a negative value or zero, it ends with an error.

Closes-Bug: #1811349
Partially-Implements: blueprint tempest-cli-unit-test-coverage
Change-Id: I4d7de89b2ad3ee91d113da3746fe393d8cce2aa2
3 years ago
Zuul 3280d8c134 Merge "Don't use deprecated configparser.readfp" 3 years ago
Martin Kopec a857880423 Improve logging in tempest cleanup
* add additional handler so that INFO messages are printed to stdout
  besided tempest.log
* replace print commands by LOG.info calls
* when --debug argument used print DEBUG messages to stdout
* add additional debug messages to improve transparency of the cleanup
  execution
* use --debug argument within tempest-cleanup ansible role to see more
  details directly in the output

Change-Id: Iee72dc411fdf5cda8a8eed8dd7f349e0866648ab
3 years ago
Andreas Jaeger 2f273243fc Don't use deprecated configparser.readfp
Running verify_tempest_config, it complains with:
  /opt/stack/tempest/tempest/cmd/verify_tempest_config.py:444:
  DeprecationWarning: This method will be removed in future versions.
  Use 'parser.read_file()' instead.

Use read_file.

Also, remove one extra use of six in this file.

Change-Id: Ia32df8e2be29bb0951efd08db9eed9e67d749e1f
3 years ago
Zuul 1e844a898e Merge "Remove the deprecated tempest-account-generator CLI" 3 years ago
Zuul eb9d67e88b Merge "Add --worker-file option in tempest" 3 years ago
Zuul 3d13f07ed6 Merge "Fix deletion of network quotas" 3 years ago
Arx Cruz c06c371b32 Add --worker-file option in tempest
This patch add the option --worker-file on tempest run command.
This will enable users to specify a worker file that will be used
by stestr to manually schedule how the tests will run.

Change-Id: I747f3abe179492da063fcaaf1123ffcf6362f966
3 years ago
Lukas Piwowarski 97b841130d Fix deletion of network quotas
Network quotas could be deleted after deletion of project. This
caused the cleanup to fail as network quotas have to be deleted
before the deletion of project.

This fix makes sure that network quotas are deleted before the
deletion of project.

Change-Id: I8576e2c6f1ae6dc90850dd3d8eade7c10942e413
3 years ago
Zuul ccd16f7a49 Merge "Cleanup images properly" 3 years ago
Lukas Piwowarski 2c83124392 Cleanup images properly
Images weren't deleted properly due to bad request sent to
glance API. Also ImageService ignored 'next' parameter returned from
glance API when listing images which is required when more images
are present.

The fix lists all images properly. If 'next' parameter is present
in the glance API response then the API is asked to send next part
of image list.

Closes-Bug: 1866988
Change-Id: I9ebeccb545576e43ef0fc96c29169ae16f261f34
3 years ago
Soniya Vyas ddcd4f44ac Remove the deprecated tempest-account-generator CLI
Tempest CLI tempest-account-generator was deprecated
4 years ago.
devstack still uses the deprecated CLI for which
patch has been proposed.

As deprecation is done long time back,
'tempest-account-generator' should be now used as
'tempest account-generator'

The following commit gives the idea of deprecation
message:-
68b8b9d26f

Depends-on: I624e1dc57a3d3533322fb298c01f70241d0400ed
Signed-off by: Soniya Vyas<svyas@redhat.com>
Change-Id: I7c18998dd877d7fd065e4d1d0950b6f6413587c3
3 years ago
Lukas Piwowarski e530f24160 Delete network quotas
NetworkQuotaService class enables deletion of network quotas which
were neglected by tempest cleanup before.

Change-Id: I83ac30960c0be39fc5147d445cb39cb3ff4c56b2
3 years ago
Zuul c6747367f4 Merge "Remove the deprecated verify-tempest-config CLI" 3 years ago
Zuul 0970274c55 Merge "Removal of deprecated argument[os-tenant-name]" 3 years ago
Soniya Vyas 195767a062 Removal of deprecated argument[os-tenant-name]
Use of os-tenant-name or OS_TENANT_NAME is deprecated.
Instead of it, os-project-name is expected to be used.

This patch depends on below mentioned patch, since
devstack still uses the deprecated argument.

Depends-on: I624e1dc57a3d3533322fb298c01f70241d0400ed
Signed-off by: Soniya Vyas<svyas@redhat.com>
Change-Id: I3b926f8abb6fce3d2eab93310ce3959c68aa9a6d
3 years ago
Soniya Vyas 4acf175de7 Remove the deprecated verify-tempest-config CLI
Tempest CLI verify-tempest-config was deprecated
4 years ago.

With assumption of all the users of this CLI have
moved to new CLI 'tempest verify_config', it is
time to remove the old deprecated CLI now.
'verify_tempest_config' should be now used as
'tempest verify_config'

The following commit gives the idea of deprecation
message:-
e45aa842bc

Signed-off by: Soniya Vyas<svyas@redhat.com>
Change-Id: Ic3dbd6f5e854e017a5bec4b1a625730ab68e767d
3 years ago
Martin Kopec 56c0b2be78 Tempest cleanup: improve iterating over projects
Currently cleanup iterates over projects and deletes all resources
tied to a particular project. However, most of the resources can be
deleted all at once without iteration over the projects.
This will fix the mentioned bug and also make the tool much more
efficient as we'll avoid many iterations and queries.

Closes-bug: #1830943
Change-Id: I82c7899a32bee0e714e71d703195085e10ea224f
4 years ago
Lukas Piwowarski 3b1311f604 Extend cleanup CLI to delete regions
RegionService class enables deletion of regions which were
neglected by tempest cleanup before.

Change-Id: I2c978a7b2151b37bb0a224bafd1be490f04950ee
Closes-Bug: #1848672
4 years ago
Zuul 8ffc2fc799 Merge "Added tempest subcommand for subunit_describe_calls" 4 years ago
Soniya Vyas 55ad7cd2bf Added tempest subcommand for subunit_describe_calls
We are adding a subcommand to tempest that is a parser for subunit
streams to determine what REST API calls are made inside of a test
and in what order they are called. Right now the implementation of
utility is as a console script and which is in argparse.

We are porting it to cliff to give a similar experience across
the codebase.

Change-Id: If95042898d8b2a148246c991d73d1a577fbcf7a0
Signed-off-by: Soniya Vyas <svyas@redhat.com>
4 years ago
Martin Kopec 7ca8602380 tempest cleanup - use admin_mgr only
Avoid using temporary managers and use only the admin one. The tool
has been using the admin_mgr for listing projects, roles, for listing
all resources during initializing a saved state so why don't use it also
for deleting all of the resources?
This wil solve the Unauthorized issue happening when the tool
was requesting credentials for the project from a different
domain.

Closes-bug: #1766582

Change-Id: Ibb5599ce48712b94dbf591e4a30cf3906cb5cdde
4 years ago
Zuul f9c363aadf Merge "Remove python shebangs from python modules" 4 years ago
Martin Kopec 219e322e7e tempest cleanup fix return code
It's a follow up fix for tempest cleanup NotImplemented error issue.
Tempest cleanup shouldn't return a non-zero return code for
NotImplemented errors as they are actually not errors, they are just
an outcome of tempest not checking availability of extensions in order
to keep it simple without any complicated logic.

Closes-bug: #1832566

Change-Id: I09e28c245c11dd3dd061df786bd137eceb97be07
4 years ago
Masayuki Igawa 3772790950
Remove python shebangs from python modules
This commit removes python shebangs from the python modules. They're
just python modules, so we don't need to have python shebangs for them.

Change-Id: I6f4428cf20be6f5ef2142030b4ede235444a4336
4 years ago
Martin Kopec bd5be763ca tempest cleanup should use keystone v3 client
tempest cleanup returns an error when it's initializing a saved
state, because it uses already deprecated v2 client.
The patch makes tempest cleanup use keystone role v3 client.

Closes-Bug: #1788561

Change-Id: Id607dec012ce48af6d4c7ee263a90c3ea2e1799c
4 years ago
Masayuki Igawa 9c25b1d0ba
Fix tempest run doc indentation
This commit fixes the tempest run documentation indentations for more
appropriate rendering[0]. Currently, it's rendered as a quote which is
weird.

[0] https://docs.openstack.org/tempest/latest/run.html#test-selection

Change-Id: I764cfff7dd07214fa44dacfa2a86476471e8fb20
4 years ago
Martin Kopec 97857948d9 Fix cleanup NotImplemented error
tempest cleanup doesn't check if the APIs it uses are
implemented or not. Therefore the patch adds a try
except block preventing tempest cleanup to fail when
some of the APIs are not implemented.

Closes-bug: #1832566

Change-Id: I9ced4af40eb0c2a22e3557caded56045a397d539
4 years ago
Martin Kopec 598b1ae854 Improve router deletion logging in tempest cleanup
Improve logging in tempest cleanup when a router and
its interfaces are being deleted. The review adds a
try except block for every attempt to remove a port.
By that addition any port error will not be hidden
behind the router error the port is attached to.
It will provide more precise error logging.

Change-Id: I475deec7b29600627f68ff07c5546e55cdab100f
4 years ago
Martin Kopec fd01fe9445 Improve logging in tempest cleanup
Add id or name of the resource which failed to delete
to the logging.

Change-Id: I04b04406e3917a63332199adf5c15b8e4ed6ca5a
4 years ago
Manik Bindlish 21491dff81 Checking config file actually exist or not in tempest run
This PS will check config file passed from command line is actually
existing or not in tempest run command. If file exists, only then it
will go for set config path otherwise will fail with value error.
Also adding and modifying unit test cases for this change.

Partially-Implements: blueprint tempest-cli-unit-test-coverage

Change-Id: I09d756be69cb3a9be8d0638c41d45a089d62b238
Closes-Bug: #1808473
4 years ago
Zuul 67e0778618 Merge "Add autopep8 to tox.ini" 4 years ago
Zuul 31db1f6f39 Merge "Update json module to jsonutils" 4 years ago
afazekas 40fcb9ba28 Add autopep8 to tox.ini
autopep8 is an automated code formatting tool for python,
it does not know everything, also not super fast,
but it is faster than I can manually reformat the code.

tools/format.sh will call the formatting,
the tox will check did you called it.

Also adding a tox -eautopep8 way to use it.

autopep8 formats the lines in one way,
where tempest used a another way it was changed.

Change-Id: I6d51b14a5a5b87761071d0927fca23ba1651aa41
4 years ago
zhulingjie 92b87a5a43 Update json module to jsonutils
oslo project provide jsonutils, and we use it in many place[1],
this PS to update the remained json moudule to oslo jsonutils for
consistency.

[1]: 9594233ffd/tempest/lib/services/volume/v1/quotas_client.py (L15)

Change-Id: Ib8d9f49a1fdfa0f5e0cfb05a193dffb83e4cfe69
4 years ago
Masayuki Igawa 13c588373c
Set concurrency default value
This commit sets the default value 0 for tempest run command.
Because stestr's run_command() requires an int value for that, but we
passes `None` if users don't specify a concurrency value. We found that
behavior with recent stestr change[0]. But we also have the bug in
tempest side.

[0] https://github.com/mtreinish/stestr/issues/231

Change-Id: I83f76acb6a106f7401904a910a5dced47c2db839
4 years ago
Tony Breeds a7c4c14493 stestr expects --concurrency to be an int
Change-Id: Ia56c182287510ffbaee412b6e2a3b1eb5ad510e0
Related: https://github.com/mtreinish/stestr/issues/231
4 years ago
Martin Kopec e681998023 Add NetworkSubnetPools to tempest cleanup
The review adds support for NetworkSubnetPools service,
so if there are leftover subnet pools, tempest cleanup
is able to detect them and remove eventually.

Change-Id: Ieecde490d5eb20e1a894a7bdf3bcf0e7a54c08e2
Related-Bug: #1812660
4 years ago
Martin Kopec 5a884bfbb0 Fix tempest cleanup
Edit service classes so that they discover initial
state of resources before deleting any.

Unify service names - f.e. if a service returns resources
in a list named server_groups, server_groups should be
the key of initial resources in the saved_state.json.

When is_preserve is True, security groups in
NetworkSecGroupService were filtered by networks present
in tempest.conf, however, these groups are associated
with a project_id, therefore it should be filtered
against projects present in tempest.conf.

Change-Id: I97d0115bbb43a089b33602df7c98e153984ceaf1
Related-Bug: #1812660
4 years ago
Martin Kopec 9e43fd8bbe Remove deprecated services from cleanup
The patch removes deprecated services from
cleanup_service.py:
 * NetworkVipService
 * NetworkMemberService
 * NetworkHealthMonitorService
 * NetworkPoolService
 * FloatingIpService
 * SecurityGroupService
The above services are not used by the cleanup tool, they
call clients which were already removed from Tempest or
the clients are marked as deprecated ones.

Change-Id: I55ddbce64404c67688600dc6b1231d0bd8ff7006
Related-Bug: #1812660
4 years ago
Martin Kopec 6caf3fabbb Fix tempest cleanup for python3
When using python3 the file which is read and
loaded by jsonutils needs to be opened in binary
mode, otherwise, it's causing problems.
It is a known bug [1] in jsonutils from
oslo.serialization module.
The patch also adds a unit test which tests
the loading of a json file.

[1] https://bugs.launchpad.net/oslo.serialization/+bug/1515231

Closes-Bug: #1806089
Change-Id: I3db71c6662d9137a4b75381de7d6dbddd3de4e09
4 years ago
Zuul 38e397f64a Merge "Fix tempest cleanup AttributeError" 4 years ago
Zuul 139b453d00 Merge "Fixing ignored value of --config parameter in tempest account-generator" 4 years ago
Martin Kopec b37903cddd Fix tempest cleanup AttributeError
It seems cleanup_service still uses deprecated
tenant_id variable, the patch fixes that.

Closes-Bug: #1812587
Change-Id: I294a2c04e70b980e0f42a29efa7f7448c31d1dc4
4 years ago