Commit Graph

267 Commits

Author SHA1 Message Date
Dmitriy Rabotyagov 0bcb0f20d8 Add missed openstack_resources_image condition
In some jobs where we run tempest we do not have all required services
Good example of that are infra jobs where only keystone is deployed.
During conversion to usage of openstack_resources role, a condition for
glance images creation task was missed, that avoided image uploads
when glance is not present.

Change-Id: Ibcf16abab20eadf984ad1c8307ad14b43a889793
2024-02-06 10:35:44 +01:00
Zuul 56d86e29bd Merge "Adopt for usage openstack_resources role" 2024-02-03 09:30:13 +00:00
Dmitriy Rabotyagov f25f81ebd1 Adopt for usage openstack_resources role
With efforts to create a resources in same, unified way,
we convert tempest role to use openstack_resources
for creating and managing openstack resources, like projects, flavors,
networks, images, etc. This should reduce maintenance costs
in case of futher collection updates and unify approach.

Depends-On: https://review.opendev.org/c/openstack/openstack-ansible-plugins/+/878794
Change-Id: I8d7609fac96935ed51e92ebf58515e8eb0c44d5c
2024-02-02 22:28:13 +00:00
Dmitriy Rabotyagov adcb83cff8 Fix condition of excludelist file removal
Due to typo in condition, we ended up in removing excludelist file right
after it being provisioned in certain circumstances.

Change-Id: I455f4e796fb8dcac29fe7947fc192baee9367187
2024-01-30 16:04:57 +01:00
Jonathan Rosser 00965ed13e Allow tempest_tempest_conf_overrides to be defined in many variables
Combine all variables starting with tempest_tempest_conf_overrides
to give a complete set of configuration to tempest when multiple
different test scenarios are enabled at the same time.

Change-Id: Iba5e061d1682d16c0516249f628f948a20580df8
2023-09-29 08:59:25 +00:00
Jonathan Rosser bd5923cf5e Ensure test exclusion file is removed when there are no exclusions
If the role variable overrides are updated to remove a set of
existing tempest test exclusions, the previous exclusions file
remains on the disk even though it is not use, and not passed
to the tempest command. This is confusing and the file should
not be present unless there are active exclusions in place.

Change-Id: I5d69bf6258a00ade825cd3c746d1443dc1a35120
2023-08-31 11:44:11 +00:00
Jonathan Rosser 242203bafa Allow include/exclude lists to be defined in many variables
Previously the os_tempest role had a single variable for
defining the include and exclude lists in order to select the
tempest tests to run.

This works for simple scenarios, where a single service
is deployed and the tests for that service are enabled through
the necessary variables set in user_variables. This approach is
used in openstack-ansible CI / AIO.

More complicated scenarios such as magnum+barbican+octavia, would
create several user_variables files each with conflicting settings
for the test settings. It is possible in this scenario for there to
be no valid tempest tests to run and tempest to fail immediately.

This patch adds the possibility to have many variables defining
the include/exclude lists which have names using a common prefix.
Any variable names matching the prefix are gathered and combined
with the original role default to make extending the test lists
easy to do in an incremental/distibuted way in the ansible variables
instead of having to maintain a single point defining all necessary
tests.

Change-Id: Ie3a9a7be849171af042567ba8a152e5df5d2cb53
2023-08-17 11:20:14 +00:00
Jonathan Rosser 9ec945a0a3 Rename includelist/excludelist file path vars
These variable names collide with the best name prefix to use when
gathering many variable names into a combined include/exclude list.

Codesearch shows no use of these as overrides and the number of
cases when an override would be needed is small.

Change-Id: Ic64165e41d24ae8dc75061589de84fa57998f03d
2023-08-16 10:25:30 +01:00
Jonathan Rosser 47deba8c31 Remove deprecated variables
More suitable replacement variables have been available for
several releases now so we can remove the deprecated vars.

Tripleo still defines these deprecated variables in several
places but seems to have made no attempt to move to the new
vars, and tripleo is itself now deprecated so we should move
ahead with removal of these vars from os_tempest.

Change-Id: I5a4a90bc963acc8b44caf7eb060b763e0f90a50f
2023-08-16 09:03:23 +01:00
Dmitriy Rabotyagov 687dcb30bf Fix linters and metadata
With update of ansible-lint to version >=6.0.0 a lot of new
linters were added, that enabled by default. In order to comply
with linter rules we're applying changes to the role.

With that we also update metdata to reflect current state.

Change-Id: Ifcb6ebfa971e324e447509e50cc7294bddd6a4a0
2023-07-14 20:37:15 +02:00
Dmitriy Rabotyagov 6125fd5e7e Build wheels only for source isntalls
Ubuntu distro installation installs tempest plugins from source.
For this scenario we're  ensuring that wheels won't be built as
repo container that should handle wheels build is simply absent in this
scenario.

For the rest usecases we're sticking with our new default to build
wheels.

Change-Id: Id643946edf4b4e21f8420d048ce8293fc40a61fc
2023-05-22 17:44:19 +02:00
Jonathan Rosser a871336aa0 Handle openstack.cloud.image from collection 1.x or 2.x
Temporary code handling both cases until support for the 2.x
collection can be merged.

Change-Id: I200bf8d09d489be1433c9a269cc6cd6a1378a6cc
2023-03-28 15:38:28 +01:00
Erik Berg 2a9d57f637 Remove redundant vars line
This line was introduced by I0230f1a93d16243fc50df79b2d0780e744706c7b
and should already be covered by the distribution_major_version line
above.

Change-Id: Ibffaadb721796d6f657972633d19bdd36e411c52
2022-09-14 14:58:11 +02:00
Damian Dabrowski 4878640e18 Make router creation independent from tempest_public_net_create
Currently when ``tempest_router_create`` is enabled, playbook requires
``tempest_public_net_create`` to be set.

It's an incorrect behavior. Router creation should only require public
network to exist. It does not matter if that public network was created
by tempest or operator.

Change-Id: Icaa223ed03837a68e9e84a89560cc2df10e3ed3e
2022-07-11 17:12:49 +02:00
Rafael Castillo 56c07080a7 Check return value for router create
The newest openstacksdk is set to rename some of the field names of
return values. This also affects the openstack.cloud collection. This
patch checks for both field names to make sure the os_tempest role
doesn't break when the collections release.

Change-Id: I4b30650a6c78e76982e22746933be7c132490a43
2022-06-20 14:03:49 -07:00
Damian Dabrowski 0566c20d99 Add support for both Credential Provider Mechanisms
Tempest currently has two different internal methods for providing
authentication to tests: dynamic credentials and pre-provisioned credentials.
Depending on which one is in use the configuration of Tempest is slightly
different.
We should provide a support for both of them.

https: //docs.openstack.org/tempest/latest/configuration.html#credential-provider-mechanisms
Change-Id: I26d69caa3f96a530bc0a4a21365404b1a84e489a
2022-04-26 16:45:14 +00:00
Damian Dabrowski 1baf863bf6 Allow to create only specific tempest resources.
In most cases, many of tempest resources are not needed.
From the other hand, some of our contributors still need them so we
can't just drop this functionality from this role.
The best solution I see is to add more flexibility and let users
choose which resources should be created by tempest role.

- public network:
  new variable: bool tempest_public_net_create (default: true)
  if false: require tempest_neutron_public_network_id to be set
  if true: require all other tempest_public_net_* variables to be set
  explanation: it'd be useful to choose if user wants to use already
    existing public net or create a new one/
- private network:
  new variable: bool tempest_private_net_create (default: false)
  if true: require all tempest_private_* variables to be set
  explanation: by default tempest has use_dynamic_credentials &
    create_isolated_networks enabled, so it spawns an usable network,
    subnet, and router when needed for each project it creates, so in
    most cases it doesn't make sense to create special 'private' net.
- router:
  new variable: bool tempest_router_create (default: false)
  if true: both tempest_public_net_create and
    tempest_private_net_create should be enabled
  explanation: same case as for private network
- image:
  new variable: bool tempest_images_create (default: true)
  if false: require tempest_glance_image_id_1,
    tempest_glance_image_id_2 to be set
  explanation: tempest needs public images, so it'd be useful to just
    use already existing ones
- flavor:
  new variable: bool tempest_flavors_create (default: true)
  if false: require tempest_nova_flavor_id_1, tempest_nova_flavor_id_2
    to be set
  explanation: tempest needs public flavors, so it'd be useful to just
    use already existing ones
- projects:
  new variable: bool tempest_projects_create (default:
    "{{ tempest_public_net_create or tempest_private_net_create or
      tempest_public_router_create }}")
  explanation: by default tempest has use_dynamic_credentials &
    create_isolated_networks enabled, so we don't need to create any
    'static' projects, but network resources spawned by tempest
    playbook belong to this project, so it should exist if any of
    these resources are going to be created

I don't see any reason why users and tempest role should be created
so i dropped this functionality.

Depends-On: https://review.opendev.org/c/openstack/openstack-ansible/+/825166
Change-Id: Icb46f5cb9e2dda6511cc49e30587f541aa7e399f
2022-04-26 16:44:02 +00:00
Zuul 0e2da6f63e Merge "Enable recursion in combine() filter" 2022-01-12 18:47:39 +00:00
Jonathan Rosser 911ac37750 Refactor use of include_vars
Use a first_found lookup instead of a with_first_found loop so that
the 'paths' parameter can be used.

This ensures that only vars from the role are included, and not vars
from a parent calling role. This can happen when a parent role has
a higher priority vars file available for inclusion than the role
it calls.

Change-Id: I08dbacef3ef29548cce58cbaee79a3fa79086259
2022-01-12 08:08:41 +00:00
Damian Dabrowski d6303c9343 Enable recursion in combine() filter
Ansible's combine() filter needs recursive=True parameter in order to recursively merge nested hashes.

https: //docs.ansible.com/ansible/latest/user_guide/playbooks_filters.html#combining-hashes-dictionaries
Change-Id: I804bf03f7e459a5e572fc55d1d40c3ba45d2d736
2022-01-11 19:20:58 +01:00
Arx Cruz 4c0fcc91c3 Add tempest_test_extra_test variable
This add a aditional test in the tempest_test_includelist. This is
required right now as a workaround for tripleo jobs, while the
implementation of the includelist in openstack-tempest-skiplist tool.
Tripleo uses os_tempest to setup and run tempest, but it doesn't run all
tempest tests. Sometimes, the list of excluded tests matches the list of
included tests and so tempest fail with no tests to run. This
tempest_test_extra_test will ensure that it will execute at least one
keystone api test to avoid this.
Right now, the tempest_test_whitelist variable is parsed to ansible via
-e command line, and so it's hard to overwrite it on tripleo side, and
it's spreaded in several different jobs with several different set of
tests. So, this is the best/easy way to fix this problem, while we work
on a long term solution.

Change-Id: Ic5f5b44d81ed39b1fa622b5a1d76e482c2aa23aa
2021-06-22 08:48:15 +02:00
Zuul 1f22d1e8d0 Merge "Generate list of failing tests" 2021-06-15 22:00:04 +00:00
Arx Cruz 472ec21a91 Generate list of failing tests
Add a file containing the list of failing tests is important to send
these to logstash and make it easy for people identify how often a
particular test is failing in a particular job.
This should not impact the time of the job or the size of the file, once
it's a small and very quickly command to run

Change-Id: Ib6c2dfc41ac48c3ca6822d6298e1cc55f5c28fbe
2021-06-15 13:01:18 +02:00
Zuul 58c5fab84c Merge "Rename whitelist and blacklist in role" 2021-06-15 00:40:51 +00:00
Zuul 3771143280 Merge "Install py3-dev when not building wheels" 2021-06-04 08:14:49 +00:00
Dmitriy Rabotyagov a12a662114 Install py3-dev when not building wheels
When we're in CI and not building wheels, we might appear missing
py3-dev inside utility container, which is required for netifaces. So we
add it as `tempest_devel_distro_packages` which will get package
installed on the required target.

Change-Id: Ie8e04a1635a32e368ec3906082f7773dcefd30d1
2021-06-02 10:59:31 +03:00
Jonathan Herlin 0e71336651 Rename whitelist and blacklist in role
'--whitelist-file' option is deprecated, use '--include-list' instead which is functionally equivalent.
Right now Tempest still supports this option for backward compatibility, however, it will be removed soon.

This change addresses the occurences of whitelist and blacklist in the os_tempest OSA role.

Change-Id: Id021d084867ef2891c381c5863b82421e90ee2ca
2021-05-25 08:15:40 +00:00
Dmitriy Rabotyagov 989557bff3 Log tempestconf inside tempest_log_dir
This will allow us to collect tempestconf.log by CI

Change-Id: Ieb050fe65947e3d2da1beb5062f509036e32a7da
2021-04-19 17:56:57 +00:00
Jonathan Rosser 435fc4115c Fix u-c filter regex
Change-Id: Ide5368b9c26b81a2824fef350ee9d9dd692cdf18
2021-04-02 09:35:49 +00:00
Zuul 778acfa18b Merge "Save tempestconf output to file" 2021-03-12 17:36:16 +00:00
Arx Cruz 7f88421c8e Save tempestconf output to file
Save the output of tempestconf to a file is good to debug what's
happening with tempestconf and debug the code

Change-Id: I34896c7ab3c0b75f2587a6bef3076366af67c592
2021-03-10 16:35:40 +01:00
Jonathan Rosser b30094a654 Remove references to unsupported operating systems
All references to Gentoo, SUSE, Debian stretch and Centos-7  are removed.
Conditional tasks, ternary operators and variables are simplified where possible
OS specific variables files are generalised where possible

Change-Id: Ie84846f8590c3ae60afd671d973a4de3c644d526
2021-03-10 12:16:40 +00:00
Jonathan Rosser 049a1aed1e Use ansible_facts[] instead of fact variables
See https://github.com/ansible/ansible/issues/73654

Change-Id: Ic75eac3e27fd542370a04f9bd946d907f0756061
2021-03-01 10:29:57 +00:00
Dmitriy Rabotyagov 4a2f3e3351 Use new openstack.cloud collection names
os_ prefixed module names are deprecated for a while and will be removed
Current usage generates a warning for users.

Change-Id: I85b5666fabfd17d4731bfa085a2e89a17b184b3a
2021-02-16 21:29:10 +02:00
Zuul 082cc2b366 Merge "Move tempest pip package from a constraint to a requirement" 2021-02-05 23:28:37 +00:00
Jonathan Rosser 1fd23f2aed Move tempest pip package from a constraint to a requirement
This is necessary to support the new pip resolver.

Depends-On: I9be6bbf4a29a4da2ddf96dc0336bc2a7d8ec9281
Depends-On: I49c75dd11d6c4e8d37fe013b7ffdfd56ff193fcd
Change-Id: If53aca6f16324d305b150466b94d3f18c8a1096a
2021-01-18 16:38:13 +00:00
Rafael Folco 49004fb05f Fix stackviz for failed tempest runs
ansible block w/ error handling was incorrect: the first block
failed when tempest executed, then the second one (which creates
stackviz) never got executed.

It also includes in the block assertion to check if tempest
failed (this is actually redundant check, not really needed).

Change-Id: Ie99060fce29f35ced77efb7b29b8f5f6e37abbcd
Closes-Bug: #1905460
2020-11-24 16:16:43 -03:00
Martin Kopec 18f796ad6a Add tempest cleanup support
If a user sets tempest_cleanup variable to true, tempest cleanup will be
executed prior tempest tests (to generate saved_state.json) and after the
tests in order to delete leaked resources if any.

Change-Id: Ief00b43237cb634ee25a18264461bfda8464bbc7
2020-11-11 19:56:17 +00:00
Zuul b4f236f5d2 Merge "Allow deployer to skip default resource creation" 2020-11-10 14:37:15 +00:00
James Denton 253f023888 Allow deployer to skip default resource creation
This patch is part of a set that aims to break out tempest
resource creation from the role, and introduces the
tempest_default_role_resources var. When true, default role
resources are created. When false, deployer-specific resources
must be created prior to executing os-tempest-install.yml or
including the os_tempest role in other playbooks.

Change-Id: I42cb8ffbe8aa8cfdcdcfcbbccf28117a27c519b1
2020-11-09 09:02:21 -06:00
Dmitriy Rabotyagov 520afd956f Add ability to define network MTU
OVN requires MTU to be set no more then 1442, so we need ability to
define non-default MTU for networks.

Change-Id: I486981f95cdfa5498f5e31222de4e58d8aa7a516
2020-10-28 19:09:47 +02:00
Arx Cruz 278ef6f829 Fix tempest init logic
The tempest init was checking if the workspace/etc directory exists, and
were creating a new workspace without pass a name, the default is
workspace, but passing a --name ensure it won't break if tempest decides
to change it.
Also, the rename command only change the name in the
$HOME/.tempest/workspace.yml, it doesn't change the path for the
particular workspace. The same happens with the move command, it just
update the path on the workspace.yml file.
With this patch, the tempest workspace is being moved properly to a
workspace_$CURDATE, all the files are copied to the new workspace,
delete the old workspace directory, and call tempest init properly.

Also adding tripleo upgrade job as nv for now, since this issue only
happen in upgrade jobs.

Change-Id: I8a3b79352819f5e980eaea7482cd6b1f1bfc47be
Closes-Bug: #1896126
2020-10-17 18:55:26 +01:00
Dmitriy Rabotyagov 5a46aff857 Remove unsupported OS
Do some role cleanup to path for not supported OS,
like gentoo or suse.
This includes bionic distro jobs, since this path is not supported
for bionic in Victoria

Fix ansible linter errors as a result of linter update.

Change-Id: I619dc6da251bd9d6f9d117e7b0cdedc2e59bf581
2020-10-16 19:44:31 +00:00
Jonathan Rosser b3f12de548 Use ansible openstack collection
Depends-On: https://review.opendev.org/718431
Depends-On: https://review.opendev.org/718362
Depends-On: https://review.opendev.org/730083
Change-Id: I8648a3ec8955d74d813a0b5b1cb90ab3a5e6ed34
2020-09-21 08:09:21 +00:00
Chandan Kumar (raukadah) 3e590ab572 Set mode for copy operation
We need to set mode for copy operation otherwise ansible-2.9.12
can lead to too restrictive default permissions[1].

Setting mode for copy operations handles the warning.

[1.] https://github.com/ansible/ansible/issues/67794

Change-Id: Ieae36a1d85a7da84ee2cd982a20dcabe9e65511f
Signed-off-by: Chandan Kumar (raukadah) <chkumar@redhat.com>
2020-08-20 11:21:07 +05:30
Dmitriy Rabotyagov 7e8f1a90f1 Deploy resources only when tempest_run is True
Setting this condition will make possible to only install tempest
without  creating weird resources. We still will install them,
when deployer explicitly set to run tempest with the role.

Change-Id: I37bc266eebd3a8455acac179055b87810143dfc4
2020-07-07 19:22:41 +03:00
Jonathan Rosser c5f44982bd Fix deprecated os_project_facts ansible module usage
This patch fixes the warning:

[DEPRECATION WARNING]: The 'os_project_facts' module has been renamed to
'os_project_info', and the renamed one no longer returns ansible_facts.

Change-Id: I7fe4bda991b968530453c620e1ea56a187a26924
2020-05-12 17:18:44 +01:00
Zuul 45b2ac75d1 Merge "Add support to tempest --worker-file option" 2020-05-04 23:21:35 +00:00
Arx Cruz 0e6476f5c1 Add support to tempest --worker-file option
This patch add support to tempest run --worker-file option.
This add the possibility to manually schedule how tempest tests will be
executed in each worker

Change-Id: I9ea47452c430c6bf5ec0ac6332cecd5d3abc7792
2020-05-04 15:54:18 +02:00
Jonathan Rosser 0317e9fc02 Refactor tempest plugin install from source
Previously the tempest plugins were installed using pip independant
of the python_venv_build role, in the past OSA could support a mixed install
of a distro tempest package and source code plugins. The mixed mode has been
removed but the tempest & tempest plugins installation tasks remain seperate.

Tempest is installed using python_venv_build, and the plugins are installed
directly using the ansible pip module. Unfortunatly, these two approaches do
not handle openstack upper-constraints in the same way, particularly for a
package that is installed from source code.

The python_venv_build role will correctly install a version of tempest
corresponding to the specified git SHA even when u-c specifies an earlier version
of the package. Unfortunately, when installing the tempest plugins with
the pip module, the previously installed tempest packages gets downgraded to
match the version specified in u-c as the pip module is unaware of the combined
source + u-c constraints generated by python_venv_build.

Tempest is an unusual case, because it is perhaps the only "top level" openstack
projects which has its own constraint appear in u-c.

This patch also corrects the use use of the venv_wheel_build_enable variable.
As a role default the value of this variable is changed in the whole scope of
the role becasue it is overridden during the stackviz install. The approach
used should be reviewed and refined in a future patch.

This patch also marks bionic/distro jobs as non voting as there has not been
a release of tempest which passes keystone test_list_user_groups test.

Change-Id: I5e8c8540b30865aaccafe59c73fae6fdd6da80a8
2020-04-22 00:24:29 +01:00