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]>
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]>
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]>
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]>
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]>
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]>
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]>
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]>
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]>
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]>
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]>
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]>
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]>
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]>
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]>
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]>
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]>
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]>
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]>
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]>
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]>
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]>
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]>
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]>
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]>
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]>
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]>