419 Commits

Author SHA1 Message Date
Douglas Viroel 5ef3d55f37 Make test polling intervals and timeouts configurable
Replace hardcoded values with four new options in the [optimize]
config group:

- model_check_interval (FloatOpt, default 1.0s): poll interval for
wait_for_instances_in_model, wait_for_instances_attributes_in_model,
and wait_delete_instances_from_model.

- resource_check_interval (FloatOpt, default 1.0s): poll interval for
all call_until_true() sleep_for= arguments and the time.sleep() call
in the generic wait_for() helper.

- resource_timeout (IntOpt, default 300s): replaces all hardcoded
duration= arguments to call_until_true() across API, scenario, and
client-functional tests. Also drives the compute-node trait-removal
retry count.

- model_timeout (IntOpt, default 300s): replaces the timeout=300
default parameter in the three model-wait helpers.

Assisted-By: Claude Code (Sonnet 4.6)
Change-Id: Iab0e70b88ffce52b0061aaa8b1f3d221347e30b9
Signed-off-by: Douglas Viroel <[email protected]>
2026-06-22 16:08:38 -03:00
Ghanshyam Maan 3ceb82d5ff Drop python 3.10
Due to constraints update(rpds-py) in requirements, Tempest master stopped
working on python 3.10.

- https://review.opendev.org/c/openstack/requirements/+/990790

Due to same reason, Tempest needs to drop the python 3.10 support[1].
Because Tempest master cannot support py3.10 anymore, it needs to be
dropped from tempest plugins also.

[1] https://review.opendev.org/c/openstack/tempest/+/991161

Change-Id: Ie5b6b847af01f2510679558e93133d56f896d0e0
Signed-off-by: Ghanshyam Maan <[email protected]>
2026-06-02 19:19:25 +00:00
morenod 83c866b357 Add comprehensive tests for action precondition
This patch adds a new test suite `TestExecuteSkippedActions` that
validates the precondition checking logic for various Watcher actions.
These tests ensure that actions are properly skipped when preconditions
are not met (resulting in `SKIPPED` state with `SUCCEEDED` action plan)
or fail appropriately when invalid parameters are provided
(resulting in `FAILED` state for both action and action plan).

The test suite covers 14 scenarios across 5 action types:

- https://docs.openstack.org/watcher/latest/actions/migrate.html
- https://docs.openstack.org/watcher/latest/actions/change_nova_service_state.html
- https://docs.openstack.org/watcher/latest/actions/resize.html
- https://docs.openstack.org/watcher/latest/actions/stop.html
- https://docs.openstack.org/watcher/latest/actions/volume_migration.html

All tests follow a consistent pattern using a helper method
`execute_actions_and_validate_states()` that:
- Creates audit templates and audits with custom actions
- Optionally executes pre-execution hooks (e.g., deleting resources)
- Executes action plans and waits for completion
- Validates expected action states and action plan final state
- Returns action details for additional verification

As this feature is not backported, skipped actions have to be excluded
from 2025* and 2024* branches on watcher project zuul jobs definition

Change-Id: Ifaf9ed0b00d9a38031a824e0a11aa91b04e06ec4
Assisted-By: Claude
Signed-off-by: morenod <[email protected]>
2026-05-18 13:26:34 +02:00
Zuul fbe0f1c217 Merge "Replace ExtendPlacementClient with tempest lib" 2026-05-11 15:26:44 +00:00
Zuul 46586ef9cf Merge "Add disk constraint validation to workload_balance" 2026-05-11 11:16:58 +00:00
Zuul 7b34db93cb Merge "Add scenario tests for boot from volume instances" 2026-05-09 19:07:13 +00:00
Chandan Kumar (raukadah) 58831c0ab3 Replace ExtendPlacementClient with tempest lib
ExtendPlacementClient duplicated list_resource_provider_traits()
and list_provider_inventory().
which is already provided by ResourceProvidersClient in tempest.
Moreover, tempest.clients.Manager exposes resource_providers_client
directly, so no manual instantiation is needed in BaseManager.

Remove ExtendPlacementClient and its imports, drop the redundant
placement_client from BaseManager, and update base.py to use
mgr.resource_providers_client instead.

It was added in tempest 40.0.0 (OpenStack 2024.2 / Dalmatian,
commit 6587e780d). The current watcher-tempest-plugin supports
2025.1 release. It will work for older supported release.

Note:
- It bumps tempest> 41.0.0 in requirements.txt as stable branches
  already using higher tempest version and also simplify
  the boolean return in has_resource_provider_trait().

- Rename the local alias placement_client to
  resource_providers_client to match the upstream tempest
  Manager attribute name.

Generated-By: Claude Sonnet 4.6
Change-Id: If2932b8b59af6de9617e768d4b9891491f1b04cd
Signed-off-by: Chandan Kumar (raukadah) <[email protected]>
2026-05-08 16:02:30 +05:30
Alfredo Moralejo 968e0cf525 Add disk constraint validation to workload_balance
This test validates that the workload_balance strategy
mechanism to discard destination hosts because of local
disk constraints works as expected when there is not available
space to acomodate instances to be migrated.

Change-Id: I5084b3f3730415ff052135cca4bbe5362e93f83d
Signed-off-by: Alfredo Moralejo <[email protected]>
2026-05-08 11:22:42 +02:00
Alfredo Moralejo 6e6f290ba6 Add scenario tests for boot from volume instances
Adds boot for volume tests for additional strategies:

- workload_balance
- workload_stabilization
- zone_migration
- node_resource_consolidation
- vm_workload_consolidation
- host_maintenance

To support this, support for boot from volume has been added to the
_create_instance and _create_one_instance_per_host method.

The tests create instances with flavor disk larger than available
disk to validate that disk constraints are calculated properly for
instances booting from volume and that instances and volumes can be
properly migrated.

A new option run_bfv_tests is added to the plugin to enable/disable
the boot from volume tests. It is disabled by default.

Depends-On: https://review.opendev.org/c/openstack/watcher/+/986486

Assisted-By: Claude
Change-Id: Iae92007c954755a0def9d4c5b5fb39c56535324d
Signed-off-by: Alfredo Moralejo <[email protected]>
2026-05-07 10:29:28 +02:00
Alfredo Moralejo b69f7edcab Remove 2024.2 jobs from the zuul gates
Release 2024.2 is EoL since 29-Apr-2026 [1]  and should not be
tested anymore.

[1] https://releases.openstack.org/

Change-Id: Iff9a3763d6b6bd8e1ff43bff1bf15045e4e180ca
Signed-off-by: Alfredo Moralejo <[email protected]>
3.8.0
2026-04-29 14:06:40 +02:00
Zuul 453639049a Merge "Add project badge" 2026-04-08 13:37:06 +00:00
Takashi Kajinami cd03c9bf18 Add stable/2026.1 job
The branch was cut, so should be tested.

Change-Id: I790a4cb0c933d403756c8a3934f8b764105748d6
Signed-off-by: Takashi Kajinami <[email protected]>
2026-03-26 14:37:17 +00:00
Alfredo Moralejo 924551f526 Parametrize promtool write URL path
Recent versions of promtool require to use base prometheus API
URL instead of the full write v1 API endpoint.

Add a new `prometheus_write_path` config option and `write_url_path`
parameter to PromtoolClient to allow overriding the URL path appended
to the base Prometheus URL for remote write operations. Defaults to
'/api/v1/write' to preserve existing behavior.

Assisted-By: Claude (claude-sonnet-4-6)
Change-Id: I7b65ea331cdc895ba05ee017abe1080acd352ab1
Signed-off-by: Alfredo Moralejo <[email protected]>
2026-03-25 13:30:58 +01:00
jgilaber 1d76705306 Add extra checks to zone migration retype test
Add two extra checks to the zone migration test covering volume retype
to prevent regressions of two bugs:

1. Ensure the src_type parameter filter volumes to retype[1]
2. Ensure that the audit does not fail if the 'with_attached_volume'
   parameter is passed to an audit without 'compute_nodes'[2]

[1] https://bugs.launchpad.net/watcher/+bug/2111507
[2] https://bugs.launchpad.net/watcher/+bug/2111429

Change-Id: I3987230d384b509921ded80777b4d5b7c407ba85
Signed-off-by: jgilaber <[email protected]>
2026-03-10 19:39:07 +01:00
jgilaber 817cecb7c8 Test zone migration volume and compute migrations
Add a new test that verifies zone migration strategy can migrate
both volumes and compute instances in the same action plan.

Refactor some code that is shared between the new test and the one for
volume migrations into a method.

Generated-By: Cursor (claude-4-sonnet)
Change-Id: I748d1316356e6ad116791eb33c3451c2a9c41636
Signed-off-by: jgilaber <[email protected]>
2026-03-10 19:39:05 +01:00
jgilaber 49e68f7556 Add test for volume migrate with zone migration
Add a test that creates a zone migration audit and migrates both an
available and attached volume. The test checks that there is more than
one cinder pool to be able to migrate volumes between them, but makes no
assertion on the backend configuration.

Depends-On: https://review.opendev.org/c/openstack/watcher/+/979276

Assited-By: Cursor (Claude-4-sonnet)
Change-Id: I4e7e103109f830e28961856dfc3c197d89347e63
Signed-off-by: jgilaber <[email protected]>
3.7.0
2026-03-10 17:46:16 +01:00
Ivan Anfimov 5433ea5ba4 Add project badge
Change-Id: I61e8385142d5b7a8797414b301d0298ab47844a0
Signed-off-by: Ivan Anfimov <[email protected]>
2026-01-14 15:56:28 +00:00
Douglas Viroel d99632e144 Consolidate and improve Zuul CI jobs for stable branches
This is a follow up from [1], to also replace current functional
stable jobs with jobs that runs scenarios tests.

[1] https://review.opendev.org/c/openstack/watcher-tempest-plugin/+/968247

Change-Id: Ia79777ae5910ad3aa3db53c6747f46a2a6ac76e0
Signed-off-by: Douglas Viroel <[email protected]>
2025-12-16 15:16:09 -03:00
Douglas Viroel 8788d53852 Fix unsupported operand types in internal methods
Adds missing call for values() method when checking
resources states. This issue is seen when running
with python3.10.

Closes-Bug: #2136134

Change-Id: I24fb5e123035ac7fc6a510d626314a32e36b5ceb
Signed-off-by: Douglas Viroel <[email protected]>
2025-12-15 10:50:31 -03:00
Alfredo Moralejo 03fdfc525d Refresh the state of the actionplan before asserting status
This is follow-up of [1]. That patch added a wait for actionplan to
reach finished state before checking the status. However, it is not
refreshing the state of the actionplan in the action_plan variable
before doint the actual assert, so it's still validating the state that
had before the wait.

[1] https://review.opendev.org/c/openstack/watcher-tempest-plugin/+/968750

Closes-Bug: #2133181

Change-Id: Id3520d9293778694ee699be4b0b4ab07144dae3a
Signed-off-by: Alfredo Moralejo <[email protected]>
2025-12-12 08:25:10 +01:00
Douglas Viroel 62d4e34ff6 Fix experimental job names after refactoring watcher jobs
After merging [1], the realdata jobs were renamed to follow
a new pattern, but we missed this update in the plugin.
This patch updates the realdata job names to the correct one.

[1] https://review.opendev.org/c/openstack/watcher/+/966942

Change-Id: Ic6da42f181bdfad2425606a791e4dc5383d1bf87
Signed-off-by: Douglas Viroel <[email protected]>
2025-12-10 15:47:14 -03:00
Zuul 26265a45f0 Merge "Add config flags to control zone migration test execution" 2025-12-10 14:18:52 +00:00
Zuul cdc45a3f2d Merge "Consolidate and improve Zuul CI job definitions" 2025-12-09 18:08:26 +00:00
jgilaber 0b81f2b911 Add config flags to control zone migration test execution
Add configuration checks to conditionally skip zone migration
tests that require specific setup or code. This allows
better control over which tests run in different CI environments.

Changes:
- Add run_zone_migration_extra_tests flag check to skip
  zone migration for instances without dst_node tests when disabled
- Add run_zone_migration_storage_tests flag check to skip
  storage-related zone migration tests when disabled

Generated-By: claude-code
Change-Id: I362a8c3e9edefe21e46e3836d5b86f151c5fb446
Signed-off-by: jgilaber <[email protected]>
2025-12-09 09:27:45 +01:00
Zuul 2f0c6b2d16 Merge "Wait action plan to finish before asserting state" 2025-12-08 23:26:31 +00:00
Alfredo Moralejo a2a762efec Skip test api.admin.test_audit.TestShowListAudit.test_list_with_limit
It's failing randomly because of an existing race condition in the audit
cancel workflow [1].

[1] https://bugs.launchpad.net/watcher/+bug/2134046

Related-Bug: #2134046

Change-Id: Ic800508d44e560fc5c5aaa88ce352dee4ad4ef68
Signed-off-by: Alfredo Moralejo <[email protected]>
2025-12-05 18:04:54 +01:00
Douglas Viroel 46975344f7 Consolidate and improve Zuul CI job definitions
This commit reorganizes and enhances the Zuul CI job configuration
to improve clarity, consistency, and coverage.
This change is based on improvements proposed to watcher repo[1].
- Replace old functional tests with tempest tests, that cover both
  api and scenario testing.

Stable branch changes still depends on the backport of [1].

Depends-On: https://review.opendev.org/c/openstack/watcher/+/966942

[1] https://review.opendev.org/c/openstack/watcher/+/966942
Change-Id: Idf72f9b3d3e4e35ab0dfd6f2f4b2f65f52048a6e
Signed-off-by: Douglas Viroel <[email protected]>
2025-12-05 08:08:14 +00:00
Douglas Viroel e028aa81e6 Wait action plan to finish before asserting state
Add explicit wait for action plan to reach a finished state before
checking if it's SUCCEEDED or CANCELLED. This prevents race conditions
where the action plan state is checked before the planner completes its
processing.

Closes-Bug: #2133181

Change-Id: Iaf43e0075b2da606eaea9c450164ba18c1516e14
Signed-off-by: Douglas Viroel <[email protected]>
2025-11-27 16:55:32 -03:00
Chandan Kumar (raukadah) acd50f8569 Improved continuous audit api test coverage
This commit reorganizes audit tests by microversion requirements and
adds comprehensive test coverage for continuous audit functionality:

It includes following changes:

* Microversion-aware test organization:
  - Introduce TestCreateUpdateDeleteAuditV11 for features requiring >= 1.1
  - Introduce TestCreateUpdateDeleteAuditV14 for features requiring >= 1.4
  - Relocate test_create_audit_event to V14 class (EVENT type needs >= 1.4)

* Continuous audit test coverage:
  - Add test for crontab-style interval expressions (*/5 * * * *)
  - Add test for start_time and end_time parameter validation
  - Add test for action plan superseding (latest RECOMMENDED, older CANCELLED)
  - Add test for runtime interval updates via PATCH operations
  - Add test for various crontab formats (minutely, hourly, daily)

* Test helper refactoring:
  - Move has_action_plans() from scenario/base.py to common/base.py
  - Add _has_multiple_action_plans() helper for superseding validation
  - Improves reusability across test modules

* Python 3.11+ compatibility:
  - Add datetime.UTC import with timezone.utc fallback

Closes-Bug: #2118904
Assisted-By: Cursor (GPT-5)
Change-Id: Idf9b8899015c4c7da48ff40af21c0a9717ded89e
Signed-off-by: Chandan Kumar (raukadah) <[email protected]>
2025-11-26 05:20:34 +00:00
Chandan Kumar (raukadah) d1edf92c8f Refactor: Extract common test utilities into shared base class
Consolidate duplicated test utilities from BaseInfraOptimTest and
BaseInfraOptimScenarioTest into a new BaseCommon class to improve
maintainability and eliminate code duplication.

Changes include:
* New common test base class (tests/common/base.py):
  - Shared resource management methods: create_audit_template,
    delete_audit_template, create_audit, cancel_audit, delete_audit,
    and delete_action_plan
  - State validation helpers: is_audit_idle, has_audit_succeeded,
    has_audit_finished, has_audit_failed
  - Type-safe constants using frozen Enum classes for IdleStates,
    AuditFinishedStates, and ActionPlanFinishedStates

* Enhanced resource lifecycle management:
  - Replace class-level resource tracking with addCleanup() for
    more reliable cleanup and better test isolation
  - Automatic cancellation of ONGOING/PENDING audits before deletion
  - Graceful handling of NotFound exceptions during cleanup

* Bug fixes:
  - Resolve IndexError in test_action_plan.py by converting from
    class-level resource_setup() to instance-level setUp()
  - Add wait_for_all_action_plans_to_finish() before audit creation
    to prevent race conditions

* Test isolation improvements:
  - Convert class methods to instance methods where appropriate
  - Skip redundant audit cancellation when audit has already succeeded

* Code cleanup:
  - Remove unused imports (time, functools, indirect data_utils)
  - Consolidate audit cancellation logic with new cancel_audit() helper

Assisted-By: Cursor (claude-4.5-sonnet)
Change-Id: Ife6392c564b239d5e30d4c53807b3ab8d6298adf
Signed-off-by: Chandan Kumar (raukadah) <[email protected]>
2025-11-25 10:40:28 +00:00
Zuul fd6208c1dd Merge "Drop job to test unmaintained 2024.1 branch" 2025-11-07 05:35:35 +00:00
jgilaber 0c8ebbdbab Drop job to test unmaintained 2024.1 branch
The 2024.1 release has moved to unmaintained, so we don't need to keep
testing it in the tempest plugin repo.

Change-Id: I3badebd9e7dbd05b77b56218358e350ef4ae2f4f
Signed-off-by: jgilaber <[email protected]>
2025-11-05 09:39:05 +01:00
Ghanshyam Maan b15be3a51e Drop python 3.9 and support python 3.13
Due to requirements repo dropped the constraints for
python3.9[1], Tempest needs to drop the python 3.9
support[2]. Because Tempest master cannot support
py3.9 anymore, it needs to be dropped from tempest
plugins also.

Also, add python 3.13 support which is tested as mandatory
in 2026.2 cycle.

[1] https://review.opendev.org/c/openstack/requirements/+/957587
[2] https://review.opendev.org/c/openstack/tempest/+/966101

Change-Id: Ia8c0b94d2fa960e3a66362e7c05fc113430af2e3
Signed-off-by: Ghanshyam Maan <[email protected]>
2025-11-04 21:00:29 +00:00
Zuul 99388fae96 Merge "Add tests for extended compute datamodel" 2024.1-last 3.6.0 2025-10-24 15:11:15 +00:00
jgilaber 1f9d0276ea Skip Storage Capacity test until it's fixed
Skip the Storage Capacity tests until
https://bugs.launchpad.net/watcher-tempest-plugin/+bug/2122430 is resolved.

Change-Id: Ie6cbbcf6a7621bf5af72d69972b92af84bb6d5f2
Signed-off-by: jgilaber <[email protected]>
2025-10-22 13:16:49 +02:00
Douglas Viroel 07f45525da Add tests for extended compute datamodel
Adds a new test to test_data_model, which should run only
with a new min_microversion that implements the extended
attributes in watcher. Some new fields depends on the
api microversion configured in wathcer, in nova_client
section. A new config option was added to skip extended
attributes tests.

Assisted-By: Cursor (claude-4-sonnet)

Change-Id: I1af52b8803ff0a7d0b66e4dad5022b1eff3aa76f
Signed-off-by: Douglas Viroel <[email protected]>
2025-10-10 08:37:29 -03:00
Zuul db37debb16 Merge "Fail if action plan cannot be execute" 2025-10-09 13:29:27 +00:00
Zuul ee4d408067 Merge "Remove resource_setup skip checks" 2025-10-07 11:12:59 +00:00
Zuul 20fd3d4535 Merge "Refactor execute_strategy method into smaller helpers" 2025-10-07 07:57:20 +00:00
Zuul 26d9c82f6a Merge "Organize strategy tests and remove duplicated tests" 2025-10-07 05:31:23 +00:00
Douglas Viroel a540cb3c0a Remove server_state check from data_model test
Remove the validation of server_state in the data_model test,
since the test can't guarantee that a notification was already
processed and the state updated from building to active. This
makes the job to fail in some runs. We don't actually need to validate
this state, which not always represents the real state of the
instance.

Change-Id: I3f87db1af19ffbef4b3fad23a3b01ea122eeccde
Signed-off-by: Douglas Viroel <[email protected]>
2025-10-06 09:40:44 -03:00
Douglas Viroel c32012d6dd Fail if action plan cannot be execute
Previous to this change, most of the scenario tests where
skipping the action plan execution if not Recommended action
plan was created. Strategy tests should always generate a
recommended action plan, to evaluate that actions are being
properly created.

Related-Bug: #2122430

Change-Id: Ib73a868cc287cb34fbb4864c2e0fbd098af2c905
Signed-off-by: Douglas Viroel <[email protected]>
2025-10-03 21:54:26 -03:00
Douglas Viroel 10dc953872 Remove resource_setup skip checks
Removes resource_setup checks that were validating the number
of enabled compute nodes. It also removes the waiting for
compute nodes to set up. This is not part of the test class
resource configuration.
Test classes now only skip tests if the min_compute_nodes
is less than the required to run.
All tests that needs at least 1 compute node enabled
will now check and fail at the start of the test.
This patch also improves some action plan valiations that
were missing from some tests.

Change-Id: I7c13b78c362aa3041643fc78af4193e687db2bf4
Signed-off-by: Douglas Viroel <[email protected]>
2025-10-03 21:54:09 -03:00
Douglas Viroel 47ddf23d77 Refactor execute_strategy method into smaller helpers
Refactor BaseInfraOptimScenarioTest to expose smaller helpers
and inline their usage in tests.
Replace duplicated code with these helpers wherever is possible.

Changes:
- Split execute_strategy into helpers
- Replaced all calls to execute_stratagy with the helper sequence
- Replace tests duplicated code with helper sequence
- Removed execute_strategy from BaseInfraOptimScenarioTest.

Assisted-By: Cursor (gpt-5)

Change-Id: I6fd55cc9631f2b3fcb2f8fbef744d886f1fe3934
Signed-off-by: Douglas Viroel <[email protected]>
2025-10-03 14:33:50 -03:00
Douglas Viroel 7fdca91ebb Organize strategy tests and remove duplicated tests
This patch organizes scenario tests by strategy, ensures they
are selected by job regexes that rely on the 'strategy' tag,
and keeps tests focused and consistent.

Assisted-By: Cursor (gpt-5)

Change-Id: Ia086042c4f4e1bb3c13b673b7fbcae227da00384
Signed-off-by: Douglas Viroel <[email protected]>
2025-10-03 14:33:50 -03:00
Douglas Viroel a1df4d09be Add basic datamodel list tests
Adds both api and scenario tests for datamodel list
operation. This feature is available since microversion
1.3 but lacks some minimal testing in the plugin

Assisted-By: Cursor (claude-3.5-sonnet)

Change-Id: Ia91d78ee102c3537a25d0eb4d17a4cf2870027fd
Signed-off-by: Douglas Viroel <[email protected]>
2025-09-25 11:17:42 -03:00
Zuul ba54aab678 Merge "Add test for volume retype with zone migration" 2025-09-22 12:18:52 +00:00
Douglas Viroel 28716df3f7 Add a scenario test with continuous audit
Our scenario tests don't have any continuos audit tests,
only api tests. The scenario test can validate if the
continuous audit thread is able to get the cluster
model updates. Note that in an environment where
both threads are in different processes, they can
build 2 different in-memory models. This can be tested
by running a continuous audit multiple times, with resource
creation between its executions.

Depends-On: https://review.opendev.org/c/openstack/watcher/+/956198

Change-Id: I45e8b4fae9abea1b9749270012f956bbc48e0049
Signed-off-by: Douglas Viroel <[email protected]>
2025-09-18 08:47:39 -03:00
Takashi Kajinami 1e78f4999f Add stable/2025.2 job
Change-Id: I2e0fcbd488644ce8bb5e1575a6ab7a8289e36475
Signed-off-by: Takashi Kajinami <[email protected]>
3.5.0
2025-09-16 16:09:43 +09:00
jgilaber 4e697c300b Add test for volume retype with zone migration
Add a test that creates a zone migration audit and retypes both an available
and attached volume.

Depends-On: https://review.opendev.org/c/openstack/watcher/+/951513
Depends-On: https://review.opendev.org/c/openstack/watcher/+/951323
Depends-On: https://review.opendev.org/c/openstack/watcher/+/957668

Assisted-By: Cursor
Change-Id: I9c87ecfca06b29565e0d4762c02d0f76512c5fe0
Signed-off-by: jgilaber <[email protected]>
2025-09-03 09:44:49 +02:00